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); }
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); }
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); }
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); }