Ejemplo n.º 1
0
        public void testCorrectWordCorrect()
        {
            string word = "hello";
            List <List <char> > results = GuessVerifier.CheckResult(word, word);

            int correct = 0;

            foreach (char x in results[1])
            {
                if (x.Equals('C'))
                {
                    correct++;
                }
            }

            Assert.AreEqual(correct, word.Length);
        }
Ejemplo n.º 2
0
        public void TestCorrectWordIncorrect()
        {
            string word = "hilol";
            List <List <char> > results = GuessVerifier.CheckResult(word, "hillo");

            int correct = 0;
            int present = 0;

            foreach (char x in results[1])
            {
                if (x.Equals('C'))
                {
                    correct++;
                }
                else if (x.Equals('P'))
                {
                    present++;
                }
            }

            Assert.AreEqual(correct, word.Length - 2);
            Assert.AreEqual(present, 2);
        }
Ejemplo n.º 3
0
 public void TestCorrectWordInvalidLengths()
 {
     Assert.ThrowsException <IndexOutOfRangeException>(() =>
                                                       GuessVerifier.CheckResult("word", "wo")
                                                       );
 }
Ejemplo n.º 4
0
 public List <List <char> > AttemptGuess(GameSessionModel currentgame, string guessWord)
 {
     IncrementGuessCounter(currentgame);
     return(GuessVerifier.CheckResult(currentgame.Currentword, guessWord));
 }