Mocking Static Methods

前端 未结 6 2196
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 15:11

Recently, I\'ve begun to use Moq to unit test. I use Moq to mock out classes that I don\'t need to test.

How do you typically deal with static methods?



        
6条回答
  •  青春惊慌失措
    2020-11-27 15:26

    Mocking frameworks like Moq or Rhinomocks can only create mock instances of objects, this means mocking static methods is not possible.

    You can also search Google for more info.

    Also, there's a few questions previously asked on StackOverflow here, here and here.

提交回复
热议问题