Ejemplo n.º 1
0
        public void Evaluates_arrange_task_submission(ArrangeTaskSubmission submission, List <bool> expectedCorrectness)
        {
            var results = _service.EvaluateArrangeTask(submission);

            var correctness = results.Select(a => a.SubmissionWasCorrect);

            correctness.ShouldBe(expectedCorrectness);
        }
Ejemplo n.º 2
0
        public List <ArrangeTaskContainerEvaluation> EvaluateArrangeTask(ArrangeTaskSubmission submission)
        {
            var arrangeTask = _learningObjectRepository.GetArrangeTask(submission.ArrangeTaskId);
            var evaluations = arrangeTask.EvaluateSubmission(submission.Containers);

            if (evaluations == null)
            {
                throw new InvalidOperationException("Invalid submission of arrange task.");
            }

            if (evaluations.Select(e => e.SubmissionWasCorrect).All(c => c))
            {
                submission.MarkCorrect();
            }
            _submissionRepository.SaveArrangeTaskSubmission(submission);

            return(evaluations);
        }
 public void SaveArrangeTaskSubmission(ArrangeTaskSubmission submission)
 {
     _dbContext.ArrangeTaskSubmissions.Add(submission);
     _dbContext.SaveChanges();
 }