开发者

Rhino Mocks -- assert no interaction with mock/stub

开发者 https://www.devze.com 2022-12-19 22:59 出处:网络
Is it possible to 开发者_运维问答tell that a mock/stub has seen no interaction at all in RhinoMocks.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号