Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the capabilities of Moq and Rhino.mocks?

I cannot find a specific feature-by-feature comparison of Moq and Rhino. All the questions are "which do you like better and why", or "here's how you do a simple mock in rhino and how it's done in moq".

I cannot find a deep comparison anywhere. I'm aware of the syntax differences, I'm not looking for answers about that. I am looking for a capability comparison. For example:

  • Rhino has Expect.On() for threaded mocking. Can Moq do this?

  • What about Multi-mocking (implementing multiple interfaces with one mock). Can Moq do this?

  • I believe Moq can now mock Protected members. Can Rhino do this?

Edit: I ended up looking at some of the other .Net frameworks as well.

like image 542
womp Avatar asked Mar 27 '09 17:03

womp


2 Answers

Thanks to those that responded over the last few weeks. I ended up writing a blog post about my findings, since I had to do so much digging that it seemed like I might as well summarize them in the hopes of helping others. The chart I posted organizes my findings:

alt text

One caveat, which I touched on in the blog post, is that the chart is useful for checking the capabilities, but the real advantages to most frameworks are their unique features. I chose Moq in the end because of the easy to use API. Also, all the information is subject to errors and change - if you disagree with something on the chart, please post a comment.

like image 83
womp Avatar answered Sep 23 '22 18:09

womp


I'm not an expert by any means, but I believe the Rhino added some of the Moq syntax so that the learning curve has been reduced to what you'd expect with MoQ. I worked with both with testing and some of the syntax was almost identical. I was initially going to go with MoQ as it was easier, but then my bud showed me the latest updates and how similar they were. Just letting ya know.

like image 21
rball Avatar answered Sep 21 '22 18:09

rball