示例#1
0
        public void HelpCommandTestMiddleCharacter()
        {
            CommandManager testCommands = new CommandManager();

            IWord word = new ProxyWord("wordtest");
            ICommand helpCommand = new HelpCommand(word);
            word.PrintView = "wor-----";

            string expectedResult = "word----";
            testCommands.Proceed(helpCommand);

            Assert.AreEqual(expectedResult, word.PrintView);
        }
示例#2
0
        public void UsedCommandWithUsedLettersTest()
        {
            using (var writer = new StringWriter())
            {
                CommandManager testCommands = new CommandManager();
                var usedLetters = new HashSet<char>() { 'a', 'b', 'c' };
                ICommand usedCommand = new UsedCommand(usedLetters);

                Console.SetOut(writer);
                usedCommand.Execute();
                writer.Flush();

                string result = writer.GetStringBuilder().ToString();
                string expected = "a b c d e f g h i j k l m n o p q r s t u v w x y z \r\n";
                Assert.AreEqual(expected, result);
            }
        }