Daniel Cazzulino just announced the birth of Moq, now this is mocking done right.

 

// ShouldExpectCallWithArgument
var mock = new Mock<IFoo>();

mock.Expect(x => x.DoInt(1)).Returns(11);
mock
.Expect(x => x.DoInt(2)).Returns(22);

Assert.AreEqual(11, mock.Instance.DoInt(1));
Assert.AreEqual(22, mock.Instance.DoInt(2));

 

Lambda is starting to make my mouth water.

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>