Invalid call, the last call has been used or no call has been made

后端 未结 5 992
夕颜
夕颜 2021-01-07 19:12

I am getting this error when I try to set a mock to have PropertyBehavior():

System.InvalidOperationException: System.InvalidOperationEx

5条回答
  •  醉话见心
    2021-01-07 19:43

    I received this error when I tried to set an expectation on a non-virtual method.

    mockedObject.Expect(a => a.NonVirtualMethod()).Returns(null);
    

    The error went away when I made NonVirtualMethod virtual.

提交回复
热议问题