예제 #1
0
        private static async Task Main(string[] args)
        {
            CancellationToken cancellationToken;

            RegisterServices();
            var examService = Container.Resolve <ExamService>();
            var proctorId   = Guid.NewGuid();
            var studentId   = Guid.NewGuid();

            var assignExamResult = await examService.AssignExamAsync("ABC", studentId, cancellationToken);

            Console.WriteLine($"Assign Exam Results: {assignExamResult}");

            var examId         = Guid.Parse(assignExamResult.ExamId);
            var questionIds    = assignExamResult.QuestionIds.Select(_ => Guid.Parse(_)).ToList();
            var studentAnswers = questionIds.Select(questionId =>
                                                    new Answer(QuestionId.With(questionId), StudentId.With(studentId), "True")).ToList();

            var studentAnswerSubmittalResult = await examService.StudentAnswersSubmittalAsync(
                examId, studentId, studentAnswers, cancellationToken);

            Console.WriteLine($"Student Answers Submittal Results: {studentAnswerSubmittalResult}");

            var startScoringResult = await examService.StartScoring(examId, cancellationToken);

            Console.WriteLine($"Scoring started results: {startScoringResult}");

            var receiveScoreExecutionResults = new List <string>();

            foreach (var answer in studentAnswerSubmittalResult.AggregateStudentAnswers)
            {
                var receiveScoreResult = await examService.ReceiveScore(
                    examId, proctorId, 100.00, answer.Id, cancellationToken);

                receiveScoreExecutionResults.Add(receiveScoreResult);
            }
            Console.WriteLine($"Scoring results: {receiveScoreExecutionResults}");
        }
예제 #2
0
 public StudentExamAnswersSubmittalCommand(Guid examId, Guid studentId, List <AnswersDto> answers) : base(ExamId.With(examId))
 {
     StudentId = StudentId.With(studentId);
     Answers   = answers.Select(_ => new Answer(QuestionId.With(_.QuestionId),
                                                StudentId.With(studentId), _.AnswerText)).ToList();
 }
예제 #3
0
 public StudentExamAnswersSubmittalCommand(Guid examId, Guid studentId, List <Answer> answers) : base(ExamId.With(examId))
 {
     StudentId = StudentId.With(studentId);
     Answers   = answers;
 }