public void ErrorsAreIgnoredWithNoErrorWriter() { var reader = Substitute.For<IConsoleReader>(); var client = new ConsoleLoopClient(reader); client.OnError("Hello"); }
public void ErrorWriterReceivesError() { const string errorText = "Hello, errors!"; var reader = Substitute.For<IConsoleReader>(); var sb = new StringBuilder(); using (var errorWriter = new StringWriter(sb)) { var client = new ConsoleLoopClient(reader, errorWriter); client.OnError(errorText); } sb.ToString().Should().Be(errorText + Environment.NewLine); }