public async Task GradeSubmissionAsync_OneCorrectAnswer_CorrectSubmission()
		{
			var question = new MultipleChoiceQuestion()
			{
				AllowMultipleCorrectAnswers = true,
				Choices = Collections.CreateList
				(
					new MultipleChoiceQuestionChoice() { Value = "A", Correct = true },
					new MultipleChoiceQuestionChoice() { Value = "B", Correct = false },
					new MultipleChoiceQuestionChoice() { Value = "C", Correct = false },
					new MultipleChoiceQuestionChoice() { Value = "D", Correct = false }
				)
			};

			var submission = new MultipleChoiceQuestionSubmission()
			{
				SelectedChoices = Collections.CreateList("A")
			};

			var grader = new MultipleChoiceQuestionGrader(question);
			var result = await grader.GradeSubmissionAsync(submission);

			Assert.True(((MultipleChoiceQuestionResult)result.Result).Correct);
			Assert.Equal(1.0, result.Score);
		}
예제 #2
0
        public async Task GradeSubmissionAsync_OneCorrectAnswer_CorrectSubmission()
        {
            var question = new MultipleChoiceQuestion()
            {
                AllowMultipleCorrectAnswers = true,
                Choices = Collections.CreateList
                          (
                    new MultipleChoiceQuestionChoice()
                {
                    Value = "A", Correct = true
                },
                    new MultipleChoiceQuestionChoice()
                {
                    Value = "B", Correct = false
                },
                    new MultipleChoiceQuestionChoice()
                {
                    Value = "C", Correct = false
                },
                    new MultipleChoiceQuestionChoice()
                {
                    Value = "D", Correct = false
                }
                          )
            };

            var submission = new MultipleChoiceQuestionSubmission()
            {
                SelectedChoices = Collections.CreateList("A")
            };

            var grader = new MultipleChoiceQuestionGrader(question);
            var result = await grader.GradeSubmissionAsync(submission);

            Assert.True(((MultipleChoiceQuestionResult)result.Result).Correct);
            Assert.Equal(1.0, result.Score);
        }