Пример #1
0
        public void EditPOST_GivenQuestionViewModelAndModelStateIsValid_WorkflowHandlerShouldBeCalled()
        {
            var questionViewModel = new QuestionViewModel()
            {
                AssessmentId             = Guid.NewGuid(),
                QuestionAnswerId         = Guid.NewGuid(),
                FurtherInformationAnswer = "answer"
            };

            _questionController.Edit(questionViewModel, A <Guid> ._);

            A.CallTo(() => _workflowHandler.SetAssessmentReviseNextStep(questionViewModel.AssessmentId, questionViewModel.QuestionAnswerId, questionViewModel.FurtherInformationAnswer)).MustHaveHappened(Repeated.Exactly.Once);
        }
Пример #2
0
        public virtual ActionResult Edit(QuestionViewModel model, Guid assessmentId)
        {
            if (ModelState.IsValid)
            {
                var result = _workflowHandler.SetAssessmentReviseNextStep(model.AssessmentId, model.QuestionAnswerId, model.FurtherInformationAnswer);

                if (result)
                {
                    return(RedirectToAction(MVC.Question.Edit(model.AssessmentId)));
                }

                return(RedirectToAction(MVC.Assessment.Index(model.PatientId)));
            }

            return(View(model));
        }