Beispiel #1
0
        public void AskAQuestion() {
            var expected = "Answer";
            using (var writer = new StringWriter()) {
                using (var reader = new StringReader(expected)) {
                    System.Console.SetOut(writer);
                    System.Console.SetIn(reader);

                    var io = new ConsoleIO();
                    var actual = io.Ask("Question");

                    Assert.Equal(actual, expected);
                    Assert.Equal("Question", writer.ToString());                    
                }
                writer.Close();
            }
        }