Back to list
Views:   28.2K
Replies:  3

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?


Hans Overkamp, Feb 13, 2010
As someone commented, there are other alternative as well. I just released a revision of Simple.Mocking ( with added support of AAA-style assertion of expected method calls to mocks.
Aug 19, 2010
Have used Rhino and Moq. MOQ is prefered for a C# person
Aug 03, 2010
Reply 1
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.
Ronald Garlit, Aug 08, 2010
Reply 2
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:

Robert Blixt, Aug 02, 2010
Reply 3
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.

Rajesh Pillai
Rajesh Pillai, Jul 31, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.