public void AlreadyIncorrectGuessDoesNotIncreaseCountOfIncorrectGuesses() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('z'); game.Guess('z'); Assert.IsTrue(game.guesses.Count == 1); }
public void GuessesUpdatedCorrectly() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('a'); game.Guess('h'); Assert.AreEqual(game.guessedWord, "ha---a-"); }
public void gameWonReturnedAsTrueWhenWordIsCorrectlyGuessed() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('h'); game.Guess('a'); game.Guess('n'); game.Guess('g'); game.Guess('m'); Assert.IsTrue(game.gameWon); }
public void gameOverFlagReturnedAsFalseWhenGameIsWon() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('h'); game.Guess('a'); game.Guess('n'); game.Guess('g'); game.Guess('m'); Assert.IsTrue(game.gameOver); }
public HangmanGame() { gameParts = new HangmanParts("hangman", 6); while (!gameParts.gameOver) { FormattedGameStatus(); if (gameParts.gameOver) { break; } // get the user guess Console.WriteLine("Enter a press"); char key = Console.ReadKey(true).KeyChar; if (Char.IsLetter(key)) { gameParts.Guess(key); } } Console.WriteLine("Game Over"); Console.WriteLine("You " + (gameParts.gameWon ? "Won" : "Lost")); Console.WriteLine("The word was " + gameParts.wordToGuess); }
public void CaseOfGuessIgnorned() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('H'); Assert.AreEqual(game.guessedWord, "h------"); }
public void CorrectGuessNotAddedToListOfIncorrectGuesses() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('h'); Assert.IsTrue(game.guesses.Count == 0); }
public void CorrectGuessAddedToGuessWord() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('h'); Assert.AreEqual(game.guessedWord, "h------"); }
public void IncorrectGussesIncreasesIncorrectGuessCounterByOne() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('z'); Assert.IsTrue(game.guesses.Count == 1); }
public void IncorrectGussesAddedToListOfIncorrectGuesses() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('z'); Assert.IsTrue(game.guesses.Contains('z')); }
public void gameOverFlagReturnedAsTrueWhenNumIncorrectGuessReachesMax() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 1); game.Guess('z'); Assert.IsTrue(game.gameOver); }
public void gameOverFlagReturnedAsFalseWhenNumIncorrectGuessIsLessThanMax() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('z'); Assert.IsFalse(game.gameOver); }
public void RepeatingGuessedLettersAreAddedAtCorrectPlaces() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('a'); Assert.AreEqual(game.guessedWord, "-a---a-"); }
public void CorrectGuessAtCorrectPlace() { Hangman.HangmanParts game = new Hangman.HangmanParts("hangman", 6); game.Guess('m'); Assert.AreEqual(game.guessedWord, "----m--"); }