public async Task ThenTheMediatorIsCalledToGetTheOrganisationResult() { //Arrange var searchTerm = "Test Org"; var pageNumber = 2; var organisationType = OrganisationType.Charities; //Act await _orchestrator.SearchOrganisation(searchTerm, pageNumber, organisationType, null, null); //Assert _mediator.Verify(x => x.SendAsync(It.Is <GetOrganisationsRequest>(c => c.SearchTerm.Equals(searchTerm) && c.PageNumber == pageNumber && c.OrganisationType == organisationType)), Times.Once); }
public async Task <ActionResult> SearchForOrganisationResults(string hashedAccountId, string searchTerm, int pageNumber = 1, OrganisationType?organisationType = null) { OrchestratorResponse <SearchOrganisationResultsViewModel> model; if (string.IsNullOrEmpty(searchTerm)) { var viewModel = new SearchOrganisationResultsViewModel { Results = new PagedResponse <OrganisationDetailsViewModel>() }; model = CreateSearchTermValidationErrorModel(viewModel); } else { model = await _orchestrator.SearchOrganisation(searchTerm, pageNumber, organisationType, hashedAccountId, OwinWrapper.GetClaimValue(@"sub")); } model.Data.IsExistingAccount = !string.IsNullOrEmpty(hashedAccountId); return(View(ControllerConstants.SearchForOrganisationResultsViewName, model)); }