I am aware of Castle's DynamicProxy and RhinoMocks, but I was wondering if, given the fact that Microsoft has introduced unit testing as a first class feature of Visual Studio, whether they have provided any standardized object mocking mechanism to accompany it?
views:
284answers:
4What is the "preferred" method of creating mock objects for use with Visual Studio unit testing?
Microsoft, at this point in time, doesn't provide their own mocking framework, and still refer to third party tools.
You can see this, even if you look through things like their official SharePoint Guidance, where they say:
"There are a variety of tools available that support unit testing with mock objects. The Training Management application uses a commercially available testing tool named Typemock Isolator that is provided by Typemock. You must install this tool if you want to run the unit tests."
If you search MSDN, there are many articles about testing frameworks. The most common references seem to be RhinoMocks, NMock, and Typemock.
I too thought that Rhino was the way to go, but after working with it for 2 months, switched to Moq.
I would highly recommend Moq if you're working with .Net 3.5. Please look at this post for some more information regarding the mocking frameworks that you are considering.
IMHO Rhino Mock is overly complicated due to many layers of extra features added to it over time.
Moq has most of same features that Rhino Mock but is designed from scratch and therefore provides much cleaner API. Moq misses a few features, most importantly the ability to assert exact sequence of mocked methods invoked.
I still find myself using Rhino Mock though, I guess at this point it's just a bad habit. I do recommend using Moq for all new projects though.