moq - how to verify method has not been called if the class swallows exceptions

前端 未结 1 910
闹比i
闹比i 2021-01-18 00:35

I am trying to test a fairly complex class using Moq and am running into a problem.

I am trying to verify that a method does NOT get called, and usually this is simp

相关标签:
1条回答
  • 2021-01-18 01:16

    Well, this is embarrassing, I've managed to solve it.

    In 3.0 you can do this:

    mFMXmlC.Verify(f=>f.Put_Queue_Response(It.IsAny<Uri>(), 
                                           It.IsAny<string>(), 
                                           It.IsAny<string>(), 
                                           It.IsAny<object>()), Times.Never());
    

    Still don't understand why VerifyAll didn't work, but this seems to fit the bill anyway. I'll leave the question up, in case someone else is looking for something similar.

    0 讨论(0)
提交回复
热议问题