예제 #1
0
        public void ErrorsAreIgnoredWithNoErrorWriter()
        {
            var reader = Substitute.For<IConsoleReader>();
            var client = new ConsoleLoopClient(reader);

            client.OnError("Hello");
        }
예제 #2
0
        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);
        }