private void InitializeIoC() { var container = new Container(x => { x.AddRegistry <CommonRegistry>(); x.AddRegistry <LoggingRegistry>(); }); var configurationService = container.GetInstance <IConfigurationService>(); var cacheConfig = configurationService.Get <CacheConfiguration>(); var azureServiceBusConfiguration = configurationService.Get <AzureServiceBusConfiguration>(); var sqlConfiguration = configurationService.Get <SqlConfiguration>(); _container = new Container(x => { x.AddRegistry(new CommonRegistry(cacheConfig)); x.AddRegistry <LoggingRegistry>(); x.AddRegistry <AzureCommonRegistry>(); x.AddRegistry <VacancyIndexerRegistry>(); x.AddRegistry(new AzureServiceBusRegistry(azureServiceBusConfiguration)); x.AddCachingRegistry(cacheConfig); x.AddRegistry <RaaRegistry>(); x.AddRegistry <VacancySourceRegistry>(); x.AddRegistry <ElasticsearchCommonRegistry>(); x.AddRegistry <ApplicationRepositoryRegistry>(); x.AddRegistry <CommunicationRepositoryRegistry>(); x.AddRegistry <UserRepositoryRegistry>(); x.AddRegistry <CandidateRepositoryRegistry>(); x.AddRegistry <UserRepositoryRegistry>(); x.AddRegistry <VacancyRepositoryRegistry>(); x.AddRegistry <JobsRegistry>(); x.AddRegistry <VacancySearchRegistry>(); x.AddRegistry <LocationLookupRegistry>(); x.AddRegistry <PostcodeRegistry>(); x.AddRegistry <EmployerDataServicesRegistry>(); x.AddRegistry <ProviderRepositoryRegistry>(); x.AddRegistry <EmployerRepositoryRegistry>(); x.AddRegistry(new RepositoriesRegistry(sqlConfiguration)); }); _logger = _container.GetInstance <ILogService>(); _vacancyEtlControlQueueConsumer = _container.GetInstance <VacancyEtlControlQueueConsumer>(); _savedSearchControlQueueConsumer = _container.GetInstance <SavedSearchControlQueueConsumer>(); _dailyDigestControlQueueConsumer = _container.GetInstance <DailyDigestControlQueueConsumer>(); _housekeepingControlQueueConsumer = _container.GetInstance <HousekeepingControlQueueConsumer>(); _vacancyStatusControlQueueConsumer = _container.GetInstance <VacancyStatusControlQueueConsumer>(); _configurationService = _container.GetInstance <IConfigurationService>(); }
public void ShouldRunProcessForEndOfPreviousDay() { var now = DateTime.UtcNow; var previousDay = now.AddDays(-1); var expectedDateTime = new DateTime(previousDay.Year, previousDay.Month, previousDay.Day, 23, 59, 59); var scheduledMessageQueue = GetScheduledMessagesQueue(); _messageServiceMock.Setup(x => x.GetMessage(It.IsAny <string>())).Returns(scheduledMessageQueue.Dequeue); var vacancyConsumer = new VacancyStatusControlQueueConsumer(_messageServiceMock.Object, _logService.Object, _mockVacancyStatusProcessor.Object); var task = vacancyConsumer.CheckScheduleQueue(); task.Wait(); //_messageServiceMock.Verify(x => x.GetMessage(It.Is<string>(queueName => queueName == ScheduledJobQueues.VacancyEtl)), Times.Exactly(queuedScheduledMessages + 1)); //_messageServiceMock.Verify(x => x.DeleteMessage(It.Is<string>(queueName => queueName == ScheduledJobQueues.VacancyEtl), It.IsAny<string>(), It.IsAny<string>()), Times.Exactly(queuedScheduledMessages == 0 ? 0 : queuedScheduledMessages - 1)); //_apprenticeshipIndexerService.Verify(x => x.CreateScheduledIndex(It.Is<DateTime>(d => d == DateTime.Today)), Times.Exactly(queuedScheduledMessages > 0 ? 1 : 0)); _mockVacancyStatusProcessor.Verify(x => x.QueueVacanciesForClosure(expectedDateTime), Times.Once); }