Ask a questionAsk a question
 

AnswerWhat Mocking Framework to use?

  • Wednesday, June 17, 2009 9:39 AMDynamic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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 for it)
    • 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.

     


Answers

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.