I am trying to test a rather complex class using Moq, and I ran into a problem.
I am trying to verify that the method is NOT being called, and usually it is easy to do this by setting MockBehavior.Strict, but here, however, the class has its own error reporting mechanism, so it swallows the exception thrown by Moq.
The .VerifyAll method at the end of the test also passes fine, which is really strange. This is a bug in Moq, are there any workarounds?
I also tried setting up a callback to this method and executing Assert.Fail inside it, but as it is swallowed, the test environment (VS 2008 built-in test) does not receive notifications about it ..
I am using Moq 2.6.1014.1. (not yet managed to upgrade to moka 3)
c # unit-testing moq
Robert Ivanc
source share