public async Task <IActionResult> SearchResultsAsync(SearchResultsViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var searchResult = await _resultLoader.FindUlnResultsAsync(User.GetUkPrn(), model.SearchUln.ToLong()); if (searchResult?.IsAllowed == true) { return(RedirectToRoute(searchResult.IsWithdrawn ? RouteConstants.ResultWithdrawnDetails : RouteConstants.ResultDetails, new { profileId = searchResult.RegistrationProfileId })); } else { await _cacheService.SetAsync(Constants.ResultsSearchCriteria, model.SearchUln); var ulnResultsNotfoundModel = new UlnResultsNotFoundViewModel { Uln = model.SearchUln.ToString() }; await _cacheService.SetAsync(string.Concat(CacheKey, Constants.SearchResultsUlnNotFound), ulnResultsNotfoundModel, CacheExpiryTime.XSmall); return(RedirectToRoute(RouteConstants.SearchResultsNotFound)); } }
public override void Given() { SearchResultsViewModel = new SearchResultsViewModel { SearchUln = SearchUln }; var mockResult = new UlnResultsNotFoundViewModel { IsAllowed = true, IsWithdrawn = false, Uln = SearchUln }; ResultLoader.FindUlnResultsAsync(AoUkprn, SearchUln.ToLong()).Returns(mockResult); }
public async override Task When() { ActualResult = await Loader.FindUlnResultsAsync(Ukprn, Uln); }