Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rhino Mocks -- assert no interaction with mock/stub

Is it possible to tell that a mock/stub has seen no interaction at all in RhinoMocks. Something along the lines of:

logger.AssertNoInteraction();

Which would assert no method has been called on the stubbed logger.

This would be a much less tedious than calling the following each time:

logger.AssertWasNotCalled(l => l.Debug(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Info(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Warning(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Error(Arg<string>.Is.Anything()));
like image 231
grootjans Avatar asked Dec 12 '25 00:12

grootjans


1 Answers

If you use a strict mock and you do not set up an expectation you will get an exception if a call was made to the mock.

like image 58
Burt Avatar answered Dec 13 '25 14:12

Burt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!