Home  /  Questions  /  Question



100   96.6
Feb 13, 2010


Looking for suggestions: what is the best Mocking package for .NET?

I am diving deep into unit testing, mocking, stubbing, IOC, and everything that goes with it.  I am looking for some guidance from those who are using these tools 'in the field.'  From what I can tell, in order of popularity, the mocking package options are as follows:

Also,reading between the lines in other discussion forums, there seems to be a transition going on from Rhino to Moq. Supposedly because it's more typesafe. Anyone have any particular experiences (good and not so good) they want to share?

Thanks,



 2 comments
 
Have used Rhino and Moq. MOQ is prefered for a C# person --- Ronald Garlit  Aug 03, 2010
 
As someone commented, there are other alternative as well. I just released a revision of Simple.Mocking (http://simpledotnet.codeplex.com/) with added support of AAA-style assertion of expected method calls to mocks. --- Mikael Waltersson  Aug 19, 2010



1,364   100.0
Jul 31, 2010
I have used "Rhino" and "Moq" and both seems to be quite good enough for most situations.  But due to the fluentness of the API's I tend to move towards "Moq"  more frequently now.

TypeMock is great but has a price tag as highlighted.

Regards,
Rajesh Pillai

1,128   99.9
Aug 02, 2010
I have only used Rhino Mock and Moq, and found Moq to be easier to understand and use. Moq does require .Net 3.5 though, which might be a deal-breaker for some.

What I am aware of is that TypeMock and JustMock are the only mocking frameworks that can mock non-virtual methods, sealed classes and static methods and classes which isn't supported in most open source/free mocking tools. If anyone know of a free mocking tool that can do this please post a comment about it.

Here is a list of other mock frameworks not mentioned in the original post:


425   99.9
Aug 08, 2010
At my company I'm pushing for MOQ as the standard for .NET Mocking frameworks along with custom mocks.

I've used Rhino.

Typemock is expensive but it is the one to use for legacy older apps that do not utilize interfaces in the application design.

Up need to understand and use dependency injection and IoC techniques with the majority of open source mock frameworks.