public void CreatePost_CalledWithValidModelAndValidParameters_ShouldCallViewModelBuilder()
        {
            var model  = PostValidAssessmentModel();
            var result = _controller.Create(model) as ViewResult;

            A.CallTo(() => _assessmentViewModelBuilder.BuildAddAssessmentCommand(A <AssessmentViewModel> ._)).MustHaveHappened();
        }
Example #2
0
        public void CreatePOST_GivenValidModel_AssessmentCommandShouldBeBuilt()
        {
            var model = new AssessmentViewModel();

            _assessmentController.Create(model);

            A.CallTo(() => _assessmentBuilder.BuildAddAssessmentCommand(model)).MustHaveHappened(Repeated.Exactly.Once);
        }
Example #3
0
        public virtual ActionResult Create(AssessmentViewModel model)
        {
            if (ModelState.IsValid && !(model.RoleId == (int)RoleIdEnum.Assessor && string.IsNullOrWhiteSpace(model.DecisionMaker)))
            {
                var command = _assessmentViewModelBuilder.BuildAddAssessmentCommand(model);

                _workflowHandler.SetAssessmentWorkflow(command);

                return(RedirectToAction(MVC.Question.Index(command.AssessmentId)));
            }

            return(View(model));
        }