tags:

views:

98

answers:

2

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:

  1. Typemock Isolator
  2. JustMock
  3. 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
+1 for full disclosure!
Sohnee
-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
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