예제 #1
0
        public void IndexPOST_GivenPatientSearchViewModelIsValid_ModelBuilderShouldBeCalled()
        {
            var model = A.Fake <PatientSearchViewModel>();

            var patients = new Patients();

            A.CallTo(() => _queryDispatcher.Dispatch <PatientByClinicalIdQuery, Patients>(A <PatientByClinicalIdQuery> ._)).Returns(patients);

            _personController.Index(model);

            A.CallTo(() => _patientBuilder.BuildPatientSearchViewModel(patients)).MustHaveHappened(Repeated.Exactly.Once);
        }
예제 #2
0
        public virtual ActionResult Index(PatientSearchViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var patientQuery = new PatientByClinicalIdQuery {
                    ClinicalId = viewModel.ClinicalSystemId
                };

                var result = _queryDispatcher.Dispatch <PatientByClinicalIdQuery, Patients>(patientQuery);

                var model = _patientViewModelBuilder.BuildPatientSearchViewModel(result);

                return(View(model));
            }

            return(View(viewModel));
        }