What are the capabilities of Moq and Rhino.mocks?

后端 未结 5 481
生来不讨喜
生来不讨喜 2020-12-22 21:09

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 i

相关标签:
5条回答
  • 2020-12-22 21:36

    Just for completeness I will note that there is now NMock3 on CodePlex. It has easy migration from NMock2, just replace the reference to NMock2.dll with a reference to NMock3.dll. It adds type safety and support for refactoring.

    0 讨论(0)
  • 2020-12-22 21:40

    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.

    0 讨论(0)
  • 2020-12-22 21:44

    Rhino has GetArgumentsForCallsMadeOn() which IMO makes it easier to verify arguments in some cases.

    0 讨论(0)
  • 2020-12-22 21:50

    I might add "Behavior Verification" into these. That seems to be Moq's biggest limitation, which Rhino (not sure about others) has no problem with.

    0 讨论(0)
  • 2020-12-22 22:01

    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.

    0 讨论(0)
提交回复
热议问题