예제 #1
0
 public void ResultsAreProcessedCorrectly()
 {
     Answer answer = new Answer(4, new int[] { 1, 2, 3, 4 });
     answer.ProcessAnswer(new int[] { 4, 5, 3, 7 });
     Assert.That(answer.AnswerDigits[0].MatchStatus == AnswerDigit.Status.WrongPosition, "A wrong position match is not identified correctly");
     Assert.That(answer.AnswerDigits[1].MatchStatus == AnswerDigit.Status.Nonmatch, "A non match is not identified correctly");
     Assert.That(answer.AnswerDigits[2].MatchStatus == AnswerDigit.Status.Match, "A match is not identified correctly");
 }
예제 #2
0
        public void LastNumberIsPopulated()
        {
            Answer answer = new Answer(4);
            answer.GenerateRandomAnswer();

            int lastRandomNumber = answer.AnswerDigits[answer.AnswerDigits.Count - 1].Number;
            Assert.That(lastRandomNumber,Is.GreaterThan(0).And.LessThan(10), "Last answer number does not contain a number.");
        }
예제 #3
0
 private void StartNewGame()
 {
     answerCount = 0;
     btnSubmit.Content = "Guess";
     correctAnswer = new Answer(4);
     correctAnswer.GenerateRandomAnswer();
     BlankInputs();
     BlankDisplay();
     txtGuessOne.Focus();
 }
예제 #4
0
 public void NumberIsNotIncludedInAnswer()
 {
     Answer answer = new Answer(4, new int[] { 1, 2, 3, 4 });
     Assert.IsFalse(answer.IsInAnswer(5), "A number is not correctly identified as not being in the results");
 }
예제 #5
0
 public void NonMatchIsIdentified()
 {
     Answer answer = new Answer(4, new int[] { 2, 2, 3, 4 });
     Assert.IsFalse(answer.IsMatch(new int[] { 1, 2, 3, 4 }), "Match not correctly identified");
 }