.NET Framework Bookmark and Share   
 index > Building Development and Diagnostic Tools for .Net > What Mocking Framework to use?
 

What Mocking Framework to use?

I am using MSTest to write my unit tests. I am just wondering what mocking framework do you recommend me to use? or you have a good experience with it.

Mocking frameworks I have seen:

  • TypeMock (although it's good but it's not free and my Company is not willing to pay forit)
  • NMock (doesn't let me mock static methods apparently)
  • EasyMock
  • RhinoMock (doesn't let me mock static methods apparently)
  • Moq

I need to be able to mock static classes and static methods (for instance mocking HttpContext)

Thanks.


Dynamic
No mocking framework based on transparent proxies will let you mock static classes /methods so you're left only with TypeMock (the rest of them are using AFAIK transparent proxies).

HTH
Paul

All Replies

  • Wednesday, June 17, 2009 1:49 PMp.b.a Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No mocking framework based on transparent proxies will let you mock static classes /methods so you're left only with TypeMock (the rest of them are using AFAIK transparent proxies).

    HTH
    Paul
  • Wednesday, June 17, 2009 2:29 PMDynamic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Paul for your response.

    I imagine I need to write some helper classes for mocking static methods that I require.

    I found this which contains some helper classes for Rhino Mocks and Moq.
p.b.a

You can use google to search for other answers

Custom Search

More Threads

• How to implement CLR profiler interfaces
• How are modules and assemblies related?
• Converting header types when using SetILFunctionBody
• Getting ValueType values in debugger
• Windows Service Crashes and JIT debug
• StepReason.STEP_EXIT
• C# example extracting local variable name from .pdb file?
• How to lookup compiler error codes?
• some java script and jsp issue
• Newbie question about MDBG sample