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

后端 未结 5 937
夕颜
夕颜 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 20:06

    You mentioned using a stub instead of a mock but before you go changing it I'd note that strangely, I get the Invalid Call exception when I used GenerateStub but not when I use GenerateMock.

    View = MockRepository.GenerateStub();
    View.Stub(v => v.Message).PropertyBehavior();
    

    This throws the Invalid call exception and yes, IAddressView.Message does have a getter and setter.

提交回复
热议问题