public void CreatePost_CalledWithInvalidModel_ShouldNotCallViewModelBuilder()
        {
            _controller.ModelState.AddModelError("error", "error");
            var result = _controller.Create(new AssessmentViewModel()) as ViewResult;

            A.CallTo(() => _assessmentViewModelBuilder.BuildAssessmentViewModel(A <Assessment> ._)).MustNotHaveHappened();
        }
Example #2
0
        public virtual ActionResult Create(Guid id)
        {
            var patient = _patientHelper.GetPatient(id);

            var roles = _roleHelper.GetRoles();

            var viewModel = _assessmentViewModelBuilder.BuildAssessmentViewModel(patient, roles);

            return(View(viewModel));
        }
Example #3
0
        public void CreateGET_GivenPatientId_AssessmentBuilderShouldBeCalled()
        {
            var assessment = new Assessment();
            var patient    = new Patient();
            var id         = Guid.NewGuid();
            var roles      = new Roles();

            A.CallTo(() => _assessmentHelper.GetAssessment(A <Guid> ._)).Returns(assessment);
            A.CallTo(() => _patientHelper.GetPatient(A <Guid> ._)).Returns(patient);
            A.CallTo(() => _roleHelper.GetRoles()).Returns(roles);

            _assessmentController.Create(id);

            A.CallTo(() => _assessmentBuilder.BuildAssessmentViewModel(patient, roles)).MustHaveHappened(Repeated.Exactly.Once);
        }