public void ShouldProvideCorrectCalculationResults() { // Arrange IOutputWriter writerMock = new TestOutputWriter(); IInputReader readerMock = new TestInputReader(); var cut = new CustomLogicComponent(readerMock, writerMock); // Act cut.DivideExample(); // Assert Assert.IsTrue(((TestOutputWriter)writerMock) .DoesItReceive("The result is: 2"), "Calculation is incorrect." + ((TestOutputWriter)writerMock).ReceivedCalls()); }
public void ShouldReadSecondArgument() { // Arrange IOutputWriter writerMock = new TestOutputWriter(); IInputReader readerMock = new TestInputReader(); var sut = new CustomLogicComponent(readerMock, writerMock); // Act sut.DivideExample(); // Assert Assert.IsTrue(((TestOutputWriter)writerMock) .DoesItReceive("Enter another number to be divided"), "Second phrase is incorrrect"); Assert.AreEqual(2, ((TestInputReader)readerMock).GetReadLineCallsCount()); }