i am required to quickly learn a mocking framework that allows mocking static methods and write test cases for an application written in C#. which framework would you recommend?
+1
A:
You can do it using the following frameworks:
- Typemock Isolator
- JustMock
- Moles (You can only stub the methods, you can't assert them).
Example of faking a static method using Isolator:
Isolate.WhenCalled(() => MyClass.MethodReturningZero()).WillReturn(1);
Disclaimer - I work at Typemock
Elisha
2010-08-29 11:39:07
+1 for full disclosure!
Sohnee
2010-09-07 13:02:40
-1 for only linking your own product... Find JustMock here:http://www.telerik.com/products/mocking.aspx and Moles here: http://research.microsoft.com/en-us/projects/moles/
michielvoo
2010-09-26 16:33:17
A:
Here are answers on how to "get there" using common mocking frameworks...
MOQ
http://stackoverflow.com/questions/2416362/mock-static-property-with-moq
Rhino
http://stackoverflow.com/questions/540239/mocking-static-methods-using-rhino-mocks
Note: Typemock comes up a lot in the answers!
Sohnee
2010-09-07 13:06:27