简体   繁体   中英

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

如果您使用严格模拟并且未设置期望,则在对模拟进行调用时将获得异常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM