Why my setup was not matched

Skip to first unread message

Hui Zhao

Oct 29, 2015, 2:44:49 PM10/29/15
to Moq Discussions
The error:
Moq.MockVerificationException : The following setups were not matched.

public class KeCallFlowApplication : ICallFlowApplication
 public void HandleCall()

 public virtual void PlayDebitAccountBalance()
  // blah

In my unit test

public void PlayDebitAccountBalance_Should_Be_Called()



var keCallFlowApplicationMock = new Mock<KeCallFlowApplication>() {CallBase = true};

// ACT

keCallFlowApplicationMock.Setup(x => x.PlayDebitAccountBalance());




 The entire message:
Result StackTrace: 
at Moq.Mock.VerifyAll()
   at KeCallFlowAplicationTest.PlayDebitAccountBalance_Should_Be_Called() 
Result Message: 
Moq.MockVerificationException : The following setups were not matched:
KeCallFlowApplication x => x.PlayDebitAccountBalance()


Ale Miralles

Oct 29, 2015, 3:37:14 PM10/29/15
to moq...@googlegroups.com
I guess in the ACT section you are missing the call to:
(Which internally ends up calling the mocked method and make the verification pass)
Maybe I'm missing something obvious here, but at a first glance the error you get is the expected behaviour.

Ale Miralles.

Post: moq...@googlegroups.com
Unsubscribe: moqdisc-u...@googlegroups.com
You received this message because you are subscribed to the Google Groups "Moq Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moqdisc+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
0 new messages