Exemple #1
0
        public PublishedFundingService(IPublishedFundingDataService publishedFundingDataService,
                                       IPublishingResiliencePolicies publishingResiliencePolicies,
                                       IPoliciesService policiesService,
                                       IOrganisationGroupGenerator organisationGroupGenerator,
                                       IPublishedFundingChangeDetectorService publishedFundingChangeDetectorService,
                                       IPublishedFundingDateService publishedFundingDateService,
                                       IMapper mapper,
                                       ILogger logger)
        {
            Guard.ArgumentNotNull(publishedFundingDataService, nameof(publishedFundingDataService));
            Guard.ArgumentNotNull(policiesService, nameof(policiesService));
            Guard.ArgumentNotNull(publishingResiliencePolicies.PublishedFundingRepository, nameof(publishingResiliencePolicies.PublishedFundingRepository));
            Guard.ArgumentNotNull(publishedFundingChangeDetectorService, nameof(publishedFundingChangeDetectorService));
            Guard.ArgumentNotNull(publishedFundingDateService, nameof(publishedFundingDateService));
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(mapper, nameof(mapper));

            _publishedFundingDataService           = publishedFundingDataService;
            _publishingResiliencePolicy            = publishingResiliencePolicies.PublishedFundingRepository;
            _policiesService                       = policiesService;
            _organisationGroupGenerator            = organisationGroupGenerator;
            _publishedFundingChangeDetectorService = publishedFundingChangeDetectorService;
            _publishedFundingDateService           = publishedFundingDateService;
            _logger = logger;
            _mapper = mapper;
        }
        public TrustIdMismatchErrorDetector(IOrganisationGroupGenerator organisationGroupGenerator,
                                            IMapper mapper,
                                            IPublishedFundingDataService publishedFundingDataService,
                                            IPublishingResiliencePolicies publishingResiliencePolicies)
        {
            Guard.ArgumentNotNull(organisationGroupGenerator, nameof(organisationGroupGenerator));
            Guard.ArgumentNotNull(mapper, nameof(mapper));
            Guard.ArgumentNotNull(publishedFundingDataService, nameof(publishedFundingDataService));
            Guard.ArgumentNotNull(publishingResiliencePolicies, nameof(publishingResiliencePolicies));

            _organisationGroupGenerator = organisationGroupGenerator;
            _mapper = mapper;
            _publishedFundingDataService = publishedFundingDataService;
            _publishingResiliencePolicy  = publishingResiliencePolicies.PublishedFundingRepository;
        }
 public void SetUp()
 {
     _organisationGroupGenerator   = Substitute.For <IOrganisationGroupGenerator>();
     _publishedFundingDataService  = Substitute.For <IPublishedFundingDataService>();
     _publishingResiliencePolicies = new ResiliencePolicies
     {
         PublishedFundingRepository     = Policy.NoOpAsync(),
         CalculationsApiClient          = Policy.NoOpAsync(),
         SpecificationsApiClient        = Policy.NoOpAsync(),
         SpecificationsRepositoryPolicy = Policy.NoOpAsync(),
         CacheProvider     = Policy.NoOpAsync(),
         PoliciesApiClient = Policy.NoOpAsync()
     };
     _mapper = new MapperConfiguration(_ =>
     {
         _.AddProfile <PublishingServiceMappingProfile>();
     }).CreateMapper();
     _errorDetector = new TrustIdMismatchErrorDetector(
         _organisationGroupGenerator,
         _mapper,
         _publishedFundingDataService,
         _publishingResiliencePolicies);
 }
        public void Setup()
        {
            _publishedProviderId  = NewRandomString();
            _publishedProviderIds = new[] { _publishedProviderId };

            _publishedFundingStatusUpdateService = Substitute.For <IPublishedFundingStatusUpdateService>();
            _publishingResiliencePolicies        = new ResiliencePolicies
            {
                PublishedFundingRepository           = Policy.NoOpAsync(),
                CalculationsApiClient                = Policy.NoOpAsync(),
                SpecificationsApiClient              = Policy.NoOpAsync(),
                SpecificationsRepositoryPolicy       = Policy.NoOpAsync(),
                PublishedIndexSearchResiliencePolicy = Policy.NoOpAsync()
            };
            _specificationsApiClient           = Substitute.For <ISpecificationsApiClient>();
            _specificationService              = new SpecificationService(_specificationsApiClient, _publishingResiliencePolicies);
            _specificationFundingStatusService = Substitute.For <ISpecificationFundingStatusService>();
            _jobsRunning = Substitute.For <IJobsRunning>();
            _logger      = Substitute.For <ILogger>();
            _publishedFundingChangeDetectorService       = Substitute.For <IPublishedFundingChangeDetectorService>();
            _publishedFundingGenerator                   = Substitute.For <IPublishedFundingGenerator>();
            _publishedProviderContentsGeneratorResolver  = Substitute.For <IPublishedProviderContentsGeneratorResolver>();
            _publishedFundingContentsPersistanceService  = Substitute.For <IPublishedFundingContentsPersistanceService>();
            _publishedProviderContentsPersistanceService = Substitute.For <IPublishedProviderContentPersistanceService>();
            _publishedProviderStatusUpdateService        = Substitute.For <IPublishedProviderStatusUpdateService>();
            _publishedFundingSearchRepository            = Substitute.For <ISearchRepository <PublishedFundingIndex> >();
            _calculationsApiClient      = Substitute.For <ICalculationsApiClient>();
            _providerService            = Substitute.For <IProviderService>();
            _jobManagement              = Substitute.For <IJobManagement>();
            _prerequisiteCheckerLocator = Substitute.For <IPrerequisiteCheckerLocator>();
            _prerequisiteCheckerLocator.GetPreReqChecker(PrerequisiteCheckerType.ReleaseAllProviders)
            .Returns(new PublishAllPrerequisiteChecker(_specificationFundingStatusService, _jobsRunning, _jobManagement, _logger));
            _prerequisiteCheckerLocator.GetPreReqChecker(PrerequisiteCheckerType.ReleaseBatchProviders)
            .Returns(new PublishBatchPrerequisiteChecker(_specificationFundingStatusService, _jobsRunning, _jobManagement, _logger));
            _generateCsvJobsLocator = Substitute.For <IGeneratePublishedFundingCsvJobsCreationLocator>();
            _mapper             = Substitute.For <IMapper>();
            _transactionFactory = new TransactionFactory(_logger, new TransactionResiliencePolicies {
                TransactionPolicy = Policy.NoOpAsync()
            });
            _publishedProviderVersionService = Substitute.For <IPublishedProviderVersionService>();
            _publishedFundingDataService     = Substitute.For <IPublishedFundingDataService>();
            _policiesService                       = Substitute.For <IPoliciesService>();
            _organisationGroupGenerator            = Substitute.For <IOrganisationGroupGenerator>();
            _publishedFundingChangeDetectorService = Substitute.For <IPublishedFundingChangeDetectorService>();
            _publishedFundingDateService           = Substitute.For <IPublishedFundingDateService>();
            _publishedFundingDataService           = Substitute.For <IPublishedFundingDataService>();
            _createPublishIntegrityJob             = Substitute.For <ICreatePublishIntegrityJob>();

            _publishedFundingService = new PublishedFundingService(_publishedFundingDataService,
                                                                   _publishingResiliencePolicies,
                                                                   _policiesService,
                                                                   _organisationGroupGenerator,
                                                                   _publishedFundingChangeDetectorService,
                                                                   _publishedFundingDateService,
                                                                   _mapper,
                                                                   _logger);

            _publishService = new PublishService(_publishedFundingStatusUpdateService,
                                                 _publishingResiliencePolicies,
                                                 _specificationService,
                                                 _prerequisiteCheckerLocator,
                                                 _publishedFundingChangeDetectorService,
                                                 _publishedFundingGenerator,
                                                 _publishedProviderContentsGeneratorResolver,
                                                 _publishedFundingContentsPersistanceService,
                                                 _publishedProviderContentsPersistanceService,
                                                 _publishedProviderStatusUpdateService,
                                                 _providerService,
                                                 _publishedFundingSearchRepository,
                                                 _calculationsApiClient,
                                                 _logger,
                                                 _jobManagement,
                                                 _generateCsvJobsLocator,
                                                 _transactionFactory,
                                                 _publishedProviderVersionService,
                                                 _publishedFundingService,
                                                 _publishedFundingDataService,
                                                 _policiesService,
                                                 _createPublishIntegrityJob
                                                 );
        }