While replacing calls to Console with calls to our injected class, we found two use cases that we did not plan for. The first use case is fairly involved and has a couple parameters we need to handle:
Console.Write("+", c = c + 1);
The second use case is more simple and doesn't take any parameters:
Console.WriteLine();
The second use case is the easiest to deal with, so let us write a quick test for that now.
In the file WriteLineTests.cs:
[Fact]public void ItCanWriteABlankLine(){ // Arrange var inout = new MockInputOutput(); // Act inout.WriteLine(); // Assert Assert.Single(inout.OutFeed); Assert.Equal(Environment.NewLine, inout.OutFeed.First());}
In the file IInputOutput.cs:
void WriteLine(string text = null);
In the file ...