public When_ProviderProximity_Controller_Download_Provider_Spreadsheet_Is_Called() { var locationService = Substitute.For <ILocationService>(); _providerProximityService = Substitute.For <IProviderProximityService>(); var routePathService = Substitute.For <IRoutePathService>(); var postcode = "CV1 2WT"; var filters = "Digital-Analog"; _searchParameters = new ProviderProximitySearchParametersDto { Postcode = postcode, SelectedRouteNames = new List <string>(filters.Split('-')) }; _providerProximityService.GetProviderProximitySpreadsheetDataAsync( Arg.Any <ProviderProximitySearchParametersDto>()) .Returns( new FileDownloadDto { FileName = "test_file.xlsx", ContentType = "application/file", FileContent = new byte[] { 01, 02 } }); var providerProximityController = new ProviderProximityController(routePathService, _providerProximityService, locationService); _result = providerProximityController.DownloadProviderProximitySpreadsheetAsync(postcode, filters).GetAwaiter().GetResult(); }
public ProviderProximityController( IRoutePathService routePathService, IProviderProximityService providerProximityService, ILocationService locationService) { _routePathService = routePathService; _providerProximityService = providerProximityService; _locationService = locationService; }
public When_ProviderProximity_Controller_GetProviderProximityResults_Is_Called_With_No_Filters() { var routes = new List <SelectListItem> { new SelectListItem { Text = "1", Value = "Route 1" }, new SelectListItem { Text = "2", Value = "Route 2" } }; var routeDictionary = new Dictionary <int, string> { { 1, "Route 1" }, { 2, "Route 2" } }; var routePathService = Substitute.For <IRoutePathService>(); routePathService.GetRouteSelectListItemsAsync().Returns(routes); routePathService.GetRouteDictionaryAsync().Returns(routeDictionary); _providerProximityService = Substitute.For <IProviderProximityService>(); _providerProximityService.SearchProvidersByPostcodeProximityAsync( Arg.Any <ProviderProximitySearchParametersDto>()).Returns ( new List <ProviderProximitySearchResultViewModelItem> { new ProviderProximitySearchResultViewModelItem { Distance = 1.4, ProviderDisplayName = "Provider display name", ProviderVenueName = "Provider venue display name" } } ); var locationService = Substitute.For <ILocationService>(); var providerProximityController = new ProviderProximityController(routePathService, _providerProximityService, locationService); _result = providerProximityController.GetProviderProximityResults(Postcode) .GetAwaiter().GetResult(); }