예제 #1
0
        public void isWinCorrectForWin()
        {
            // Arrange
            WordToGuess  wordToGuess = new WordToGuess();
            const string THE_WORD    = "dakota";

            wordToGuess.setWord(THE_WORD);
            Guess  guess         = new Guess();
            string guessedLetter = "d";

            guess.guessedLetter(guessedLetter, wordToGuess);
            string ignore = wordToGuess.getGuessesSoFar(guessedLetter);

            guessedLetter = "a";
            guess.guessedLetter(guessedLetter, wordToGuess);
            ignore        = wordToGuess.getGuessesSoFar(guessedLetter);
            guessedLetter = "k";
            guess.guessedLetter(guessedLetter, wordToGuess);
            ignore        = wordToGuess.getGuessesSoFar(guessedLetter);
            guessedLetter = "o";
            guess.guessedLetter(guessedLetter, wordToGuess);
            ignore        = wordToGuess.getGuessesSoFar(guessedLetter);
            guessedLetter = "t";
            guess.guessedLetter(guessedLetter, wordToGuess);
            ignore = wordToGuess.getGuessesSoFar(guessedLetter);

            // Act
            bool actualIsWin = wordToGuess.isWin();

            // Assert
            Assert.IsTrue(actualIsWin);
        }
예제 #2
0
        public void getGuessedSoFarCorrect()
        {
            // Arrange
            WordToGuess  wordToGuess = new WordToGuess();
            const string THE_WORD    = "jellybean";

            wordToGuess.setWord(THE_WORD);
            Guess        guess          = new Guess();
            const string GUESSED_LETTER = "a";

            guess.guessedLetter(GUESSED_LETTER, wordToGuess);

            // Act
            string actualGuessSoFar = wordToGuess.getGuessesSoFar(GUESSED_LETTER);

            // Assert
            const string EXPECTED_GUESSED_SO_FAR = "_ _ _ _ _ _ _ a _ ";

            Assert.AreEqual(EXPECTED_GUESSED_SO_FAR, actualGuessSoFar);
        }
예제 #3
0
 public string getGuessedSoFar()
 {
     return(wordToGuess.getGuessesSoFar(guess.getMostRecentGuess()));
 }