Inheritance: IQuizModel
 public QuizControllerTest()
 {
     _quizManagementService = A.Fake<IQuizManagementService>();
     _controller = new QuizController(_quizManagementService);
     _quizModelWithId = A.Fake<IQuizModel>();
     _quizWithoutId = A.Fake<Quiz>();
     _createQuizViewModel = A.Fake<CreateQuizViewModel>();
     _questionViewModel = A.Fake<QuestionViewModel>();
     _addQuestionToQuizViewModel = new AddQuestionToQuizViewModel
     {
         QuizId = 1,
         Question = _questionViewModel
     };
     _question = new Question();
 }
Exemple #2
0
        public async Task<IHttpActionResult> AssignToGroup(AssignToGroupQuizViewModel assignToGroupQuizViewModel)
        {
            var quiz = new Quiz {QuizId = assignToGroupQuizViewModel.QuizId};
            var group = assignToGroupQuizViewModel.Group.ToGroup();

            try
            {
                await
                    _quizManagementService.AssignQuizToGroupAsync(new AssignedQuiz
                    {
                        EndDate = assignToGroupQuizViewModel.EndDateTime,
                        StartDate = assignToGroupQuizViewModel.StartDateTime,
                        Quiz = quiz,
                        Group = (Group)group,
                        NumberOfQuestions = assignToGroupQuizViewModel.NumberOfQuestions
                    });
            }
            catch (InvalidAssignedTestException exception)
            {
                return BadRequestWithModelState(exception);
            }
            return Ok();
        }