/// <summary>
        /// Returns a mock QuestionResolver.
        /// </summary>
        private IQuestionGraderFactory GetMockQuestionGraderFactory(
            Question resolvedQuestion,
            QuestionSubmission submission,
            ScoredQuestionResult gradeResult)
        {
            var questionGraderFactory = new Mock <IQuestionGraderFactory>();

            questionGraderFactory
            .Setup
            (
                m => m
                .CreateQuestionGrader(resolvedQuestion)
                .GradeSubmissionAsync(submission)
            ).ReturnsAsync(gradeResult);

            return(questionGraderFactory.Object);
        }
        public async Task GradeSubmissionAsync_InteractiveAttemptsRemaining_ReturnsResultWithScore()
        {
            var store = GetUserQuestionDataStore
                        (
                numAttempts: 1,
                numAttemptsRemaining: 2,
                interactive: true
                        );

            var status               = CreateUserQuestionStatus(attemptsRemaining: true);
            var statusCalculator     = GetMockQuestionStatusCalculator(store, status);
            var submission           = CreateQuestionSubmission(assignmentQuestionId: 1);
            var resolvedQuestion     = new MethodQuestion();
            var scoredQuestionResult = new ScoredQuestionResult(result: null, score: 0.5);
            var resolverFactory      = GetMockQuestionResolverFactory(store, resolvedQuestion);
            var serializer           = GetMockJsonSerializer("Contents", submission);
            var graderFactory        = GetMockQuestionGraderFactory
                                       (
                resolvedQuestion,
                submission,
                scoredQuestionResult
                                       );

            var questionSolver = GetQuestionSolver
                                 (
                questionResolverFactory: resolverFactory,
                questionGraderFactory: graderFactory,
                questionStatusCalculator: statusCalculator,
                jsonSerializer: serializer
                                 );

            var result = await questionSolver.GradeSubmissionAsync
                         (
                store,
                submission,
                SubmissionDate
                         );

            Assert.Equal(scoredQuestionResult, result.ScoredQuestionResult);
            Assert.Null(result.SubmissionDate);
        }