public void Arrange()
        {
            _geocodeService  = new Mock <IGeocodeService>();
            _mappingService  = new Mock <IMappingService>();
            _vacanciesApi    = new Mock <ILivevacanciesAPI>();
            _vacanciesMapper = new VacanciesMapper();
            _logger          = new Mock <ILogger <VacanciesRepository> >();
            _countryMapper   = new CountryMapper();

            _geocodeService.Setup(s => s.GetFromPostCode(It.IsAny <string>())).ReturnsAsync(coordinatesResponse);


            _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(),
                                                                                    It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse));
            _mappingService.Setup(s => s.GetStaticMapsUrl(It.IsAny <SFA.DAS.Campaign.Domain.Vacancies.Location>())).Returns("url");


            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, Mock.Of <IStandardsRepository>());
        }
        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 void Arrange()
        {
            _geocodeService   = new Mock <IGeocodeService>();
            _mappingService   = new Mock <IMappingService>();
            _vacanciesApi     = new Mock <ILivevacanciesAPI>();
            _standardsService = new Mock <IStandardsRepository>();
            _vacanciesMapper  = new VacanciesMapper();
            _logger           = new Mock <ILogger <VacanciesRepository> >();
            _countryMapper    = new CountryMapper();

            _standards = new List <int>()
            {
                1, 2
            };


            _standardIds = string.Join(',', _standards);

            _geocodeService.Setup(s => s.GetFromPostCode(It.IsAny <string>())).ReturnsAsync(coordinatesResponse);


            _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(),
                                                                                    It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse));

            _standardsService.Setup(s => s.GetByRoute(routeId)).ReturnsAsync(_standards);

            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, _standardsService.Object);
        }