We are Silver开发者_StackOverflow中文版light Unit Test Framework for testing.
Which one will be better for my team? Rhino Mocks or Moq. No one has any experience with using a framework like this.
What are the pros and cons of using each framework in this environment?
Take a look at both, and see which syntax suites you and your teams skillset.
Rhino Mocks has been around for nearly 4 years, and supports a couple different symantics. The record/playback is the oldest, and the Arrange Act Assert (AAA) is the newest. I would say that in the community, Rhino Mocks is the standard framework due to how long it has been around, and how easy it is to find examples, documentation, and help with.
Moq is really about 1 year old, and relies heavily on .Net 3.5 syntax, like lambdas. I think because of how new it is, it might be harder to find people who have used it, and get help with it.
More important than the framework you choose, is getting an understanding of how mocks help you test, and also how they can change the way you think about designing systems for testability. In the end, the framework doesn't matter, the experience and knowledge matters.
There's not much impact of Silverlight itself on the frameworks, and using them is not much different than doing so in full .NET
RM is said to have steeper learning curve, and MoQ allegedly has cleaner API, but RM on the other hand, has been around for much longer, and probably supports more corner-case scenarios.
I'd suggest to spike with both, and choose whichever you find suits you better.
I prefer Moq for its lamba-like syntax.
I find it very difficult to use Moq with ref/out parameters in functions setup's... Switched to Rhino because of this
精彩评论