예제 #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");
 }