Ejemplo n.º 1
0
        public void CheckWordPrintViewAfterProcessingTheHelpCommandTest()
        {
            Player player = Player.Instance;
            player.Name = "Milena";
            player.AttemptsToGuess = 0;

            var checkManager = new CheckManager(player);
            IWord word = new ProxyWord("test");
            checkManager.DefineCommands(word);
            checkManager.CheckCommand("Help", word);

            Assert.AreEqual(word.PrintView, "t---");
        }
Ejemplo n.º 2
0
        public void IsTheHasHelpUsedStateFalseWhenUsingHelpOptionTest()
        {
            Player player = Player.Instance;
            player.Name = "Milena";
            player.AttemptsToGuess = 0;

            var checkManager = new CheckManager(player);
            IWord word = new ProxyWord("test");
            checkManager.DefineCommands(word);
            checkManager.HasHelpUsed = true;

            using (var writer = new StringWriter())
            {
                Console.SetOut(writer);
                checkManager.CheckCommand("Help", word);

                writer.Flush();

                string result = writer.GetStringBuilder().ToString();
                string expected = "You have already used your help option!\r\n" +
                          "The secret word is:----\r\n";

                Assert.AreEqual(expected, result);
            }
        }
Ejemplo n.º 3
0
        public void IsTheHasHelpUsedStateTrueWhenUsingHelpOptionTest()
        {
            Player player = Player.Instance;
            player.Name = "Milena";
            player.AttemptsToGuess = 0;

            var checkManager = new CheckManager(player);
            IWord word = new ProxyWord("test");
            checkManager.DefineCommands(word);
            checkManager.CheckCommand("Help", word);

            Assert.IsTrue(checkManager.HasHelpUsed);
        }