Mocking Static methods using Rhino.Mocks

前端 未结 6 1073
夕颜
夕颜 2020-11-29 07:14

Is it possible to mock a static method using Rhino.Mocks? If Rhino does not support this, is there a pattern or something which would let me accomplish the same?

6条回答
  •  借酒劲吻你
    2020-11-29 07:32

    I have been mocking using moq, I don't think we can mock static members using this because moQ creates a new proxy for the target (class or interface). So only the inheritable members (virtual in case of class, public in terms of interface ) can be mocked. Clearly, static members are not inherited, hence the problem.

提交回复
热议问题