예제 #1
0
        public void CountCorrectAnswers_set_the_count_to_zero()
        {
            int      actualCount = 0;
            Exercise exercise    = new Exercise {
                FirstNumber = 1, SecondNumber = 1, Level = "Beginner", QuestionId = "someguid"
            };
            Mock <IExercise> mockExercise    = new Mock <IExercise>();
            ExerciseService  exerciseService = new ExerciseService(mockExercise.Object);

            exerciseService.Answers.Add(new SysAnswer {
                QuestionId = "someguid", Answer = 2
            });
            UserAnswer userAnswer = new UserAnswer {
                QuestionId = "someguid", Answer = 3
            };
            int expectedCount = exerciseService.CountCorrectAnswers(userAnswer);

            Assert.IsTrue(expectedCount == actualCount);
        }