grootjans
grootjans

Reputation: 612

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()));

Upvotes: 3

Views: 499

Answers (1)

Burt
Burt

Reputation: 7758

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.

Upvotes: 6

Related Questions