Пример #1
0
        public void CommandFactoryCreatesTop()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                             new Validator(), new HangmanGame(new WordInitializer()));
            var top = engine.CommandFactory.CreateCommand("top");

            Assert.IsNotNull(top);
        }
Пример #2
0
        public void CommandFactoryCreatesTop()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                           new Validator(), new HangmanGame(new WordInitializer()));
            var top = engine.CommandFactory.CreateCommand("top");

            Assert.IsNotNull(top);
        }
Пример #3
0
        public void CommandFactoryCreatesRestart()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                             new Validator(), new HangmanGame(new WordInitializer()));
            var restart = engine.CommandFactory.CreateCommand("restart");

            Assert.IsNotNull(restart);
        }
Пример #4
0
        public void CommandFactoryCreatesRestart()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                           new Validator(), new HangmanGame(new WordInitializer()));
            var restart = engine.CommandFactory.CreateCommand("restart");

            Assert.IsNotNull(restart);
        }
        public void HangmanEngineIsCreatedAndFactoryIsPartOfIt()
        {
            var factory = new CommandFactory();
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), factory,
                             new Validator(), new HangmanGame(new WordInitializer()));

            var testFactoryReference = engine.CommandFactory;

            Assert.AreSame(factory, testFactoryReference);
        }
        public void HangmanEngineIsCreatedAndCurrentGamePropertyCanBeSet()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                             new Validator(), new HangmanGame(new WordInitializer()));

            var testPropThisGameEnded = engine.HasCurrentGameEnded;
            testPropThisGameEnded = true;

            Assert.AreEqual(testPropThisGameEnded, true);
        }
        public void HangmanEngineIsCreatedAndIsHelpUsedPropertyCanBeSet()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                             new Validator(), new HangmanGame(new WordInitializer()));

            var testPropHelp = engine.IsHelpUsed;
                testPropHelp = true;

            Assert.AreEqual(testPropHelp, true);
        }
        public void GameEngineShouldInitializeCorrectly()
        {
            var fakePrinter = new Mock<IPrinter>();
            var fakeReader = new Mock<IReader>();
            var fakeEngine = new Mock<GameEngine>();
            fakePrinter.Setup(p => p.PrintEnterLetterOrCommandMessage());
            fakeReader.Setup(r => r.ReadLine()).Verifiable();

            var engine = new HangmanEngine(fakePrinter.Object, fakeReader.Object, new Logic.Factories.CommandFactory(), new Logic.Utils.Validator(), new Logic.Games.HangmanGame(new WordInitializer()));
            engine.Initialize();
        }
Пример #9
0
        public void HangmanEngineIsCreatedAndFactoryIsPartOfIt()
        {
            var factory = new CommandFactory();
            var engine  = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), factory,
                                            new Validator(), new HangmanGame(new WordInitializer()));


            var testFactoryReference = engine.CommandFactory;

            Assert.AreSame(factory, testFactoryReference);
        }
Пример #10
0
        public void HangmanEngineIsCreatedAndIsHelpUsedPropertyCanBeSet()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                           new Validator(), new HangmanGame(new WordInitializer()));

            var testPropHelp = engine.IsHelpUsed;

            testPropHelp = true;

            Assert.AreEqual(testPropHelp, true);
        }
Пример #11
0
        public void HangmanEngineIsCreatedAndAllGamesPropertyCanBeSet()
        {
            var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                           new Validator(), new HangmanGame(new WordInitializer()));


            var testPropAllGamesEnded = engine.HaveAllGamesEnded;

            testPropAllGamesEnded = true;

            Assert.AreEqual(testPropAllGamesEnded, true);
        }
Пример #12
0
        public void GameEngineShouldInitializeCorrectly()
        {
            var fakePrinter = new Mock <IPrinter>();
            var fakeReader  = new Mock <IReader>();
            var fakeEngine  = new Mock <GameEngine>();

            fakePrinter.Setup(p => p.PrintEnterLetterOrCommandMessage());
            fakeReader.Setup(r => r.ReadLine()).Verifiable();

            var engine = new HangmanEngine(fakePrinter.Object, fakeReader.Object, new Logic.Factories.CommandFactory(), new Logic.Utils.Validator(), new Logic.Games.HangmanGame(new WordInitializer()));

            engine.Initialize();
        }
Пример #13
0
 /// <summary>
 /// Execute command. Ends the game and closes the program by setting HasCurrentGameEnded and HaveAllGamesEnded to true and braking all the loops.
 /// </summary>
 /// <param name="engine">The game engine</param>
 public void Execute(HangmanEngine engine)
 {
     engine.HasCurrentGameEnded = true;
     engine.HaveAllGamesEnded   = true;
 }
Пример #14
0
 /// <summary>
 /// Execute command. Reveals a hidden letter from the word
 /// </summary>
 /// <param name="gameEngine">The game engine</param>
 public void Execute(HangmanEngine gameEngine)
 {
     gameEngine.RevealLetter(gameEngine.HangmanGame.WordInitializer.Word, gameEngine.HangmanGame.WordInitializer.GuessedWordLetters);
     gameEngine.IsHelpUsed = true;
 }
Пример #15
0
 public void CommandFactoryCreatesLetterGuessIfAWrongCommandIsPassed() // TODO: get test to pass
 {
     var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                    new Validator(), new HangmanGame(new WordInitializer()));
     var defaultLetterGuessCase = engine.CommandFactory.CreateCommand("brum");
 }
Пример #16
0
 /// <summary>
 /// Execute command. Trigures printing of the top results from scoreboard
 /// </summary>
 /// <param name="engine">The game engine</param>
 public void Execute(HangmanEngine engine)
 {
     engine.Printer.PrintAllRecords(engine.Scoreboard.TopFiveRecords);
 }
Пример #17
0
 public void CommandFactoryCreatesLetterGuess()
 {
     var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                      new Validator(), new HangmanGame(new WordInitializer()));
     var letterGuess = engine.CommandFactory.CreateCommand("LetterGuess");
 }
Пример #18
0
 /// <summary>
 /// Execute command. Reveals a hidden letter from the word
 /// </summary>
 /// <param name="gameEngine">The game engine</param>
 public void Execute(HangmanEngine gameEngine)
 {
     gameEngine.RevealLetter(gameEngine.HangmanGame.WordInitializer.Word, gameEngine.HangmanGame.WordInitializer.GuessedWordLetters);
     gameEngine.IsHelpUsed = true;
 }
Пример #19
0
 /// <summary>
 /// Execute command. Restarts the game with a new secret word.
 /// </summary>
 /// <param name="engine"></param>
 public void Execute(HangmanEngine engine)
 {
     engine.Initialize().StartGame();
 }
 /// <summary>
 /// Ececute command. Calls a method to process the letter guess
 /// </summary>
 /// <param name="engine"></param>
 public void Execute(HangmanEngine engine)
 {
     engine.ProcessUserGuess(this.inputLetter);
 }
Пример #21
0
 /// <summary>
 /// Execute command. Restarts the game with a new secret word. 
 /// </summary>
 /// <param name="engine"></param>
 public void Execute(HangmanEngine engine)
 {
     engine.Initialize().StartGame();
 }
Пример #22
0
 /// <summary>
 /// Execute command. Trigures printing of the top results from scoreboard
 /// </summary>
 /// <param name="engine">The game engine</param>
 public void Execute(HangmanEngine engine)
 {
     engine.Printer.PrintAllRecords(engine.Scoreboard.TopFiveRecords);
 }
Пример #23
0
 public void CommandFactoryCreatesLetterGuessIfAWrongCommandIsPassed()
 {
     var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                      new Validator(), new HangmanGame(new WordInitializer()));
     var defaultLetterGuessCase = engine.CommandFactory.CreateCommand("brum");
 }
Пример #24
0
 /// <summary>
 /// Execute command. Ends the game and closes the program by setting HasCurrentGameEnded and HaveAllGamesEnded to true and braking all the loops.
 /// </summary>
 /// <param name="engine">The game engine</param>
 public void Execute(HangmanEngine engine)
 {
     engine.HasCurrentGameEnded = true;
     engine.HaveAllGamesEnded = true;
 }
 /// <summary>
 /// Ececute command. Calls a method to process the letter guess
 /// </summary>
 /// <param name="engine"></param>
 public void Execute(HangmanEngine engine)
 {
     engine.ProcessUserGuess(this.inputLetter);
 }
Пример #26
0
 public void CommandFactoryCreatesLetterGuess()
 {
     var engine = new HangmanEngine(new ConsolePrinter(), new ConsoleReader(), new CommandFactory(),
                                    new Validator(), new HangmanGame(new WordInitializer()));
     var letterGuess = engine.CommandFactory.CreateCommand("LetterGuess");
 }