コード例 #1
0
ファイル: AnswerTest.cs プロジェクト: CharlesEast/Charles
 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
ファイル: AnswerTest.cs プロジェクト: CharlesEast/Charles
        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
ファイル: AnswerTest.cs プロジェクト: CharlesEast/Charles
 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
ファイル: AnswerTest.cs プロジェクト: CharlesEast/Charles
 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");
 }