Beispiel #1
0
 void canGetValidRandomNumber()
 {
     SuspendPerson sp = new SuspendPerson();
     int max = 4;
     int seed = sp.getValidRandomSeed(max);
     Assert.InRange(seed, 0, max);
 }
Beispiel #2
0
        void canGetLetterWhenGuessedAndBlankOtherwise()
        {
            SuspendPerson sp = new SuspendPerson();
            List<char> guessed = new List<char>() { 'a', 'x', 'd' };

            Assert.Equal('a', sp.getLetterOrBlank(guessed, 'a'));
            Assert.Equal('_', sp.getLetterOrBlank(guessed, 'c'));
        }
Beispiel #3
0
        void canInitGuessWordListWithOrDefaultIfGivenEmptyList()
        {
            SuspendPerson sp = new SuspendPerson();
            string[] defaultWords = { "porcupine" };


            List<string> actualWordList = sp.initGuessWordList(new string[] { "" });
            List<string> expectedWordList = new List<string>(defaultWords);
            Assert.Equal(expectedWordList, actualWordList);

        }
Beispiel #4
0
        void canInitGuessWordListWithGivenList()
        {
            SuspendPerson sp = new SuspendPerson();
            string[] words = { "abc", "def" };
            string[] defaultWords = { "porcupine" };

            List<string> actualWordList = sp.initGuessWordList(words);
            List<string> expectedWordList = new List<string>(words);
            Assert.Equal(expectedWordList, actualWordList);


        }
Beispiel #5
0
        void canGetGameStatusWinLoseOrGoing()
        {
            SuspendPerson sp = new SuspendPerson();
            string guessWord = "enemy";
            int lives = 3;
            int matched = 3;
            Assert.Equal(0, sp.getGameStatus(lives, matched, guessWord));
            lives = 0;
            matched = 3;
            Assert.Equal(-1, sp.getGameStatus(lives, matched, guessWord));
            lives = 3;
            matched = 4;
            Assert.Equal(1, sp.getGameStatus(lives, matched, guessWord));


        }