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);
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="vacanciesRepository">Vacancies repository.</param>
 /// <param name="headHunterClient">Client for Head Hunter Api.</param>
 public VacancyService(
     IVacanciesRepository vacanciesRepository,
     IHeadHunterClient headHunterClient)
 {
     _vacanciesRepository = vacanciesRepository;
     _headHunterClient    = headHunterClient;
 }
Esempio n. 3
0
 public VacanciesController(IVacanciesRepository repoInstance)
 {
     if (repoInstance == null)
     {
         throw new Exception("Repository is null!");
     }
     repository = repoInstance;
 }
Esempio n. 4
0
 public DemandsController(IDemandsRepository repoInstance, IVacanciesRepository vacanciesRepoInstance)
 {
     if (repoInstance == null || vacanciesRepoInstance == null)
     {
         throw new Exception("Repository is null!");
     }
     repository          = repoInstance;
     vacanciesRepository = vacanciesRepoInstance;
 }
Esempio n. 5
0
        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);

            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, Mock.Of <IStandardsRepository>());

            _standardIds = null;
        }
        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>();
            _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>());
        }
Esempio n. 8
0
 public GetAllVacanciesHandler(IVacanciesRepository repository, ILogger <GetAllVacanciesHandler> logger, IMapper mapper)
 {
     _repository = repository;
     _logger     = logger;
     _mapper     = mapper;
 }
Esempio n. 9
0
 public FindApprenticeshipController(IVacanciesRepository vacanciesService, IMappingService mappingService, IStandardsRepository repository)
 {
     _vacanciesService = vacanciesService;
     _mappingService   = mappingService;
     _repository       = repository;
 }
Esempio n. 10
0
 public RemoveVacanciesHandler(IMapper mapper, ILogger <RemoveVacanciesHandler> logger, IVacanciesRepository repository)
 {
     _mapper     = mapper;
     _logger     = logger;
     _repository = repository;
 }
Esempio n. 11
0
 public VacanciesService(IVacanciesRepository vacanciesRepository, IApplicationsRespository applicationsRepository)
 {
     _vacanciesRepository    = vacanciesRepository;
     _applicationsRepository = applicationsRepository;
 }