public void AddATest() { string expected = "ABCAAA"; //'In the test you use the stub:' var firstDeep = new FirstDeep(new SecondDeepStub()); //'In production code you use the "real" SecondDeep:' //'var firstDeep = new FirstDeep(new SecondDeep());' string res = firstDeep.AddA("ABC"); Assert.AreEqual(expected, res); }
public void AddAAATest() { // Arrange Mock <ISecondDeep> secondDeep = new Mock <ISecondDeep>(); secondDeep.Setup(x => x.SomethingToDo(It.IsAny <string>())).Returns(true); // Act FirstDeep fd = new FirstDeep(secondDeep.Object); // Assert Assert.That(fd.AddA("ABD"), Is.EqualTo("ABCAAA")); }