How to mock extension methods with Rhino Mock?

后端 未结 4 1524
日久生厌
日久生厌 2020-12-20 15:25

I have extended objects of type IDataReader with some extension methods that I needed. The problem is now when I try to mock the IDataReader, the extended method is not incl

4条回答
  •  情话喂你
    2020-12-20 15:57

    Disclosure: I work for Telerik.

    Extension methods are in fact static methods concealed as instance methods. RhinoMock cannot mock static methods and there's no way you can do it, unless you use another mocking library, which uses a profiler.

    Such a library is JustMock by Telerik.

提交回复
热议问题