is it possible to mock/fake an extension method?

后端 未结 3 1776
忘掉有多难
忘掉有多难 2020-12-10 14:50

I\'m using a controller extension, and I tried to mock it using FakeItEasy (v 1.7.4) like this:

A.CallTo(() => controller.RenderView(A.Ignor         


        
3条回答
  •  遥遥无期
    2020-12-10 15:35

    If the extension method is declared in a separate assembly, you could link in a replacement assembly with the same namespace.

    You'd have to replace any other required types from this assembly too, though.

提交回复
热议问题