示例#1
0
        public void ExitAppIsCalledForNPlayAgainInput()
        {
            var output      = new TestOutput();
            var input       = new TestInput(new string[] { "2", "book", "n" });
            var wordChecker = new TestWordChecker(true);
            var appRunner   = new AppRunner(output, wordChecker, input);

            appRunner.Run();

            Assert.Contains("Okie - Bye!", output.CalledText);
        }
示例#2
0
        public void UserIsNotifiedForWrongInput()
        {
            var output      = new TestOutput();
            var input       = new TestInput(new string[] { "2", "gh65", "book", "n" });
            var wordChecker = new TestWordChecker(true);
            var appRunner   = new AppRunner(output, wordChecker, input);

            appRunner.Run();

            Assert.Contains("Sorry, you can only enter letters - please try again.", output.CalledText);
        }
示例#3
0
        public void ExitAppCalledOnSecondInput()
        {
            var output      = new TestOutput();
            var input       = new TestInput(new string[] { "1", "n" });
            var wordChecker = new TestWordChecker(false);
            var appRunner   = new AppRunner(output, wordChecker, input);

            appRunner.Run();

            Assert.False(appRunner.Running);
            Assert.Equal(2, input.CalledCount);
        }
示例#4
0
        public void NumberOfTimesRunWordsCalled(bool result, string word, string expected)
        {
            var output      = new TestOutput();
            var input       = new TestInput(new string[] { "2", word, "n" });
            var wordChecker = new TestWordChecker(result);
            var appRunner   = new AppRunner(output, wordChecker, input);

            appRunner.Run();

            Assert.Equal(1, wordChecker.CalledCount);
            Assert.Contains(expected, output.CalledText);
        }