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); }
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(); }
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); }
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(); }
/// <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> /// 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; }
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"); }
/// <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); }
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"); }
/// <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); }
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"); }