Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

looking for a C# mocking framework that allows mocking static methods [closed]

Tags:

c#

mocking

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?

like image 262
Aadith Ramia Avatar asked Aug 29 '10 11:08

Aadith Ramia


1 Answers

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

like image 50
Elisha Avatar answered Oct 05 '22 23:10

Elisha