Closed TheTribe closed 11 years ago
Sometimes I want to be able to set the MockBehavior to Strict instead of using Default / Loose. If I want to do that, I have to do something like:
MockBehavior
Strict
Default
Loose
var mock = new Mock<IService>(MockBehavior.Strict); mock.Setup(service => service.Method(It.IsAny<Parameter>()) .Returns(new ReturnValue()); container.Update(mock.Object);
It seems like I should be able to do this instead:
container.Mock<IService>(MockBehavior.Strict) .Setup(service => service.Method(It.IsAny<Parameter>()) .Returns(new ReturnValue());
Sometimes I want to be able to set the
MockBehavior
toStrict
instead of usingDefault
/Loose
. If I want to do that, I have to do something like:It seems like I should be able to do this instead: