I'm new to C#/.NET but I've been doing TDD for quite some time now. I want to know what is the best framework that can be used for mocking objects while writing tests in C#?
Asked
Active
Viewed 5,922 times
4
-
http://stackoverflow.com/questions/37359/what-c-mocking-framework-to-use http://stackoverflow.com/questions/1718463/what-are-the-real-world-pros-and-cons-of-each-of-the-major-mocking-frameworks http://stackoverflow.com/questions/642620/what-should-i-consider-when-choosing-a-mocking-framework-for-net – Jørn Schou-Rode Mar 16 '10 at 09:10
-
Refer [Poll - Which Isolation(mocking) framework do you use in .NET?](http://polldaddy.com/poll/3746444/) and [Why do we need yet another NET mocking framework](http://blogs.clariusconsulting.net/kzu/why-do-we-need-yet-another-net-mocking-framework/) – LCJ Feb 03 '14 at 10:17
3 Answers
5
Popular options
Moq and Rhino are both regular mock/stub framework. TypeMock Isolator is a bit special, as it modifies the IL to allow mocking of types you have no control over. Some like this a lot. Others feel it is too intrusive.

Brian Rasmussen
- 114,645
- 34
- 221
- 317
-
My recommendation is for Rhino Mocks - although the lambda syntax of Moq is nice, Rhino Mocks can do some things that Moq is unable to do as yet, for example, support for ref and out parameters. Haven't tried TypeMock but can imagine it being very useful when there is absolutely no way that one is able to change the code under test. – Russ Cam Mar 16 '10 at 08:57
-
3