コード例 #1
0
        public void OutOfLives_ZeroLives_ReturnsTrue()
        {
            HangmanMain hm    = MakeHangman();
            int         lives = 0;

            Assert.IsTrue(hm.OutOfLives(lives));
        }
コード例 #2
0
        public void OutOfLives_PositiveLives_ReturnsFalse()
        {
            HangmanMain hm    = MakeHangman();
            int         lives = 3;

            Assert.IsFalse(hm.OutOfLives(lives));
        }
コード例 #3
0
        public void RemoveLife_InCorrectGuess_ReturnsTrue()
        {
            HangmanMain hm    = MakeHangman();
            string      word  = "abc";
            string      guess = "d";

            Assert.IsTrue(hm.RemoveLife(word, guess));
        }
コード例 #4
0
        public void ValidInput_DoubleCharacter_ReturnsFalse()
        {
            HangmanMain hm = MakeHangman();

            string guess = "ab";

            Assert.IsFalse(hm.ValidInput(guess));
        }
コード例 #5
0
        public void ValidInput_SingleCharacter_ReturnsTrue()
        {
            HangmanMain hm = MakeHangman();

            string guess = "a";

            Assert.IsTrue(hm.ValidInput(guess));
        }
コード例 #6
0
        public void SelectRandomWord_ReturnsString()
        {
            HangmanMain   hm    = MakeHangman();
            List <string> words = new List <string> {
                "big", "car", "lorry"
            };

            Assert.IsNotNull(hm.SelectRandomWord(words));
        }
コード例 #7
0
        public void GenerateWordString_IncorrectGuesses_ReturnsCorrectFormat()
        {
            HangmanMain   hm      = MakeHangman();
            string        word    = "abc";
            List <string> guesses = new List <string> {
                "d", "a"
            };

            Assert.AreEqual("a__", hm.GenerateWordString(word, guesses));
        }
コード例 #8
0
        public void FormatGuessesForPrinting_ReturnsCorrectString()
        {
            HangmanMain hm = MakeHangman();

            List <string> guesses = new List <string> {
                "a", "b", "c"
            };

            Assert.AreEqual("abc", hm.FormatGuessesForPrinting(guesses));
        }
コード例 #9
0
        public void AddStringToList_IncreasesListItems()
        {
            HangmanMain   hm      = MakeHangman();
            List <string> guesses = new List <string> {
            };
            string guess          = "a";

            guesses = hm.AddStringToList(guesses, guess);

            Assert.AreEqual(1, guesses.Count);
        }
コード例 #10
0
        public void DuplicateGuess_Duplicate_ReturnsTrue()
        {
            HangmanMain hm = MakeHangman();

            List <string> guesses = new List <string> {
                "a", "b"
            };
            string guess = "a";

            Assert.IsTrue(hm.DuplicateGuess(guesses, guess));
        }
コード例 #11
0
        public void WordGuessed_NotAllCorrect_ReturnsFalse()
        {
            HangmanMain hm = MakeHangman();

            string        word    = "abc";
            List <string> guesses = new List <string> {
                "a", "b", "d"
            };

            Assert.IsFalse(hm.WordGuessed(word, guesses));
        }
コード例 #12
0
        public void RoundNotFinished_WordNotGuessedAndLivesZero_ReturnsFalse()
        {
            HangmanMain hm = MakeHangman();

            int           lives   = 0;
            string        word    = "abc";
            List <string> guesses = new List <string> {
                "a", "b"
            };

            Assert.IsFalse(hm.RoundNotFinished(word, guesses, lives));
        }