질문하기질문하기
 

답변됨What Mocking Framework to use?

  • 2009년 6월 17일 수요일 오전 9:39Dynamic 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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.

     


답변

모든 응답

  • 2009년 6월 17일 수요일 오후 1:49p.b.a 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    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
  • 2009년 6월 17일 수요일 오후 2:29Dynamic 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    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.