chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Is there way to expect no calls on a method? I tried setting the expected number of calls to 0 in an ExpectAndReturn, but the test still passes even if the method is called.

Thanks,
Steve
asked by vertebrate (1.8k points)

1 Answer

0 votes
Hi,
What you need is to use the Strict flag and set it to true.
this will cause all unexpected calls to throw an exception.

:!: By default the Strict flags is set to false on mock created fro regular classes and is set to true on mocks created from interfaces and abstract classes.
answered by lior (13.2k points)
...