I'm testing NSubstitute as a new mock/stub framework. The syntax is very simple and convenient. Here's a sample:
//Create:var calculator = Substitute.For();
//Set a return value:calculator.Add(1,2).Returns(3);
Assert.AreEqual(3, calculator.Add(1, 2));
//Check received calls:calculator.Received().Add(1, Arg.Any());calculator.DidNotReceive().Add(2, 2); //Raise eventscalculator.PoweringUp += Raise.Event();
See more at http://nsubstitute.github.com/
No comments:
Post a Comment