Moq C# built in class

后端 未结 2 609
野趣味
野趣味 2020-12-20 20:51

I\'m trying to mock out the SearchResultCollection class. However, when I try to intercept a call to the PropertiesLoaded getter, my test throws an Exception:



        
2条回答
  •  伪装坚强ぢ
    2020-12-20 21:05

    This is not possible with Moq. You can only mock interfaces, abstract classes, and classes with virtual methods (and in the latter case, you can only use Setup() to mock the behavior of virtual methods).

提交回复
热议问题