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); }
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)); }