public async Task And_300_Results_Then_Vacancies_Api_Is_Called_Twice_Filtered_On_Postcode_And_Distance() { _searchResultCount = 300; _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(), It.Is <int>(a => a == 1), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse, 250)); _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(), It.Is <int>(a => a == 2), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse, _searchResultCount - 250)); sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, Mock.Of <IStandardsRepository>()); await sut.GetByPostcode(postcode, 20); _vacanciesApi.Verify(v => v.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(2)); }
public async Task Then_Coordinates_Are_Retrieved_For_Postcode_By_GeocodeService() { await sut.GetByPostcode(postcode, 10); _geocodeService.Verify(s => s.GetFromPostCode(postcode), Times.Once); }