Esempio n. 1
0
        public void GuessShouldReturnIncorrectGuessResultIfLetterDoesNotExistInWord(string letter, Type result)
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            hangman.Guess(letter).Should().BeOfType(result);
        }
Esempio n. 2
0
        public void GuessShouldOnlyAcceptASingleLetter(string letter, Type result)
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            hangman.Guess(letter).Should().BeOfType(result);
        }
Esempio n. 3
0
        public void ShouldReturnTrueIfGameIsUnderway()
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            hangman.GameState.Should().Be(GameState.InProgress);
        }
Esempio n. 4
0
        public void ShouldReturnHangmanClass()
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            hangman.Should().NotBeNull();
        }
Esempio n. 5
0
        public void ShouldReturnGameLostIfIncorrectGuessesAreExceededButMoreLettersAreAdded(int incorrectGuesses, params string[] values)
        {
            var secretWord = "secRetWord";

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            foreach (var letter in values)
            {
                hangman.Guess(letter);
            }

            hangman.GameState.Should().Be(GameState.Lost);
        }
Esempio n. 6
0
        public void ShouldReturnGameInProgressIfAllLettersAreNotGuessedAsYes(params string[] values)
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            foreach (var letter in values)
            {
                hangman.Guess(letter.ToString());
            }

            hangman.GameState.Should().Be(GameState.InProgress);
        }
Esempio n. 7
0
        public void ShouldReturnGameWonIfAllLettersGuessedCorrectly()
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            foreach (var letter in secretWord)
            {
                hangman.Guess(letter.ToString());
            }

            hangman.GameState.Should().Be(GameState.Won);
        }
Esempio n. 8
0
        public void ShouldReturnGameWonIfAllLettersAreGuessedButMoreLettersAreAdded(params string[] values)
        {
            var secretWord       = "secRetWord";
            var incorrectGuesses = 5;

            var hangman = new HangmanKata.UI.Models.Hangman(secretWord, incorrectGuesses);

            foreach (var letter in values)
            {
                hangman.Guess(letter.ToString());
            }

            hangman.GameState.Should().Be(GameState.Won);
        }