public void SetUp()
        {
            _specificationId  = NewRandomString();
            _validationResult = new ValidationResult();

            _validator = Substitute.For <ISpecificationIdServiceRequestValidator>();
            _validator.Validate(_specificationId)
            .Returns(_validationResult);

            _specificationService       = Substitute.For <ISpecificationService>();
            _publishedFundingRepository = Substitute.For <IPublishedFundingRepository>();
            _fundingCountProcessor      = Substitute.For <IPublishedProviderFundingCountProcessor>();
            _fundingCsvDataProcessor    = Substitute.For <IPublishedProviderFundingCsvDataProcessor>();
            _csvUtils   = Substitute.For <ICsvUtils>();
            _blobClient = Substitute.For <IBlobClient>();

            _service = new PublishedProviderStatusService(_validator, _specificationService, _publishedFundingRepository, new ResiliencePolicies
            {
                PublishedFundingRepository     = Polly.Policy.NoOpAsync(),
                SpecificationsRepositoryPolicy = Polly.Policy.NoOpAsync(),
                BlobClient = Polly.Policy.NoOpAsync()
            },
                                                          _fundingCountProcessor,
                                                          _fundingCsvDataProcessor,
                                                          _csvUtils,
                                                          _blobClient);
        }
コード例 #2
0
        public PublishedProviderStatusService(
            ISpecificationIdServiceRequestValidator validator,
            ISpecificationService specificationService,
            IPublishedFundingRepository publishedFundingRepository,
            IPublishingResiliencePolicies publishingResiliencePolicies,
            IPublishedProviderFundingCountProcessor fundingCountProcessor,
            IPublishedProviderFundingCsvDataProcessor fundingCsvDataProcessor,
            ICsvUtils csvUtils,
            IBlobClient blobClient)
        {
            Guard.ArgumentNotNull(validator, nameof(validator));
            Guard.ArgumentNotNull(specificationService, nameof(specificationService));
            Guard.ArgumentNotNull(publishedFundingRepository, nameof(publishedFundingRepository));
            Guard.ArgumentNotNull(publishingResiliencePolicies, nameof(publishingResiliencePolicies));
            Guard.ArgumentNotNull(publishingResiliencePolicies.PublishedFundingRepository, nameof(publishingResiliencePolicies.PublishedFundingRepository));
            Guard.ArgumentNotNull(publishingResiliencePolicies.SpecificationsRepositoryPolicy, nameof(publishingResiliencePolicies.SpecificationsRepositoryPolicy));
            Guard.ArgumentNotNull(publishingResiliencePolicies.BlobClient, nameof(publishingResiliencePolicies.BlobClient));
            Guard.ArgumentNotNull(fundingCountProcessor, nameof(fundingCountProcessor));
            Guard.ArgumentNotNull(fundingCsvDataProcessor, nameof(fundingCsvDataProcessor));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));
            Guard.ArgumentNotNull(blobClient, nameof(blobClient));

            _validator                            = validator;
            _specificationService                 = specificationService;
            _publishedFundingRepository           = publishedFundingRepository;
            _fundingCountProcessor                = fundingCountProcessor;
            _publishedFundingRepositoryResilience = publishingResiliencePolicies.PublishedFundingRepository;
            _specificationsRepositoryPolicy       = publishingResiliencePolicies.SpecificationsRepositoryPolicy;
            _blobClientPolicy                     = publishingResiliencePolicies.BlobClient;
            _fundingCsvDataProcessor              = fundingCsvDataProcessor;
            _csvUtils   = csvUtils;
            _blobClient = blobClient;
        }
コード例 #3
0
        protected BasePublishingCsvGenerator(
            IJobManagement jobManagement,
            IFileSystemAccess fileSystemAccess,
            IBlobClient blobClient,
            IPublishingResiliencePolicies policies,
            ICsvUtils csvUtils,
            ILogger logger,
            IFileSystemCacheSettings fileSystemCacheSettings,
            IPublishedProviderCsvTransformServiceLocator publishedProviderCsvTransformServiceLocator) : base(jobManagement, logger)
        {
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(blobClient, nameof(blobClient));
            Guard.ArgumentNotNull(policies?.BlobClient, nameof(policies.BlobClient));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(fileSystemCacheSettings, nameof(fileSystemCacheSettings));
            Guard.ArgumentNotNull(publishedProviderCsvTransformServiceLocator, nameof(publishedProviderCsvTransformServiceLocator));

            _fileSystemAccess        = fileSystemAccess;
            _blobClient              = blobClient;
            _blobClientPolicy        = policies.BlobClient;
            _csvUtils                = csvUtils;
            _fileSystemCacheSettings = fileSystemCacheSettings;
            _publishedProviderCsvTransformServiceLocator = publishedProviderCsvTransformServiceLocator;
            _logger = logger;
        }
コード例 #4
0
        protected CsvBatchProcessBase(IFileSystemAccess fileSystemAccess, ICsvUtils csvUtils)
        {
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));

            _fileSystemAccess = fileSystemAccess;
            _csvUtils         = csvUtils;
        }
        public PublishedGroupsCsvBatchProcessor(IPublishedFundingRepository publishedFundingRepository,
                                                IPublishingResiliencePolicies resiliencePolicies,
                                                IFileSystemAccess fileSystemAccess,
                                                ICsvUtils csvUtils) : base(fileSystemAccess, csvUtils)
        {
            Guard.ArgumentNotNull(publishedFundingRepository, nameof(publishedFundingRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.PublishedFundingRepository, nameof(resiliencePolicies.PublishedFundingRepository));

            _publishedFundingRepository = publishedFundingRepository;
            _publishedFundingPolicy     = resiliencePolicies.PublishedFundingRepository;
        }
        public PublishedFundingOrganisationGroupCsvBatchProcessor(IPublishingResiliencePolicies publishingResiliencePolicies,
                                                                  IFileSystemAccess fileSystemAccess,
                                                                  ICsvUtils csvUtils,
                                                                  IPublishedFundingRepository publishedFunding)
            : base(fileSystemAccess, csvUtils)
        {
            Guard.ArgumentNotNull(publishedFunding, nameof(publishedFunding));
            Guard.ArgumentNotNull(publishingResiliencePolicies?.PublishedFundingRepository, nameof(publishingResiliencePolicies.PublishedFundingRepository));

            _publishedFundingPolicy = publishingResiliencePolicies.PublishedFundingRepository;
            _publishedFunding       = publishedFunding;
        }
        public PublishedProviderCsvBatchProcessor(IPublishedFundingRepository publishedFunding,
                                                  IPublishedFundingPredicateBuilder predicateBuilder,
                                                  IPublishingResiliencePolicies resiliencePolicies,
                                                  IFileSystemAccess fileSystemAccess,
                                                  ICsvUtils csvUtils) : base(fileSystemAccess, csvUtils)
        {
            Guard.ArgumentNotNull(publishedFunding, nameof(publishedFunding));
            Guard.ArgumentNotNull(predicateBuilder, nameof(predicateBuilder));
            Guard.ArgumentNotNull(resiliencePolicies?.PublishedFundingRepository, nameof(resiliencePolicies.PublishedFundingRepository));

            _publishedFunding           = publishedFunding;
            _predicateBuilder           = predicateBuilder;
            _publishedFundingRepository = resiliencePolicies.PublishedFundingRepository;
        }
コード例 #8
0
        public FundingStreamPaymentDatesIngestion(IFundingStreamPaymentDatesRepository fundingStreamPaymentDates,
                                                  IPublishingResiliencePolicies resiliencePolicies,
                                                  ICsvUtils csvUtils,
                                                  ILogger logger)
        {
            Guard.ArgumentNotNull(fundingStreamPaymentDates, nameof(fundingStreamPaymentDates));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));
            Guard.ArgumentNotNull(resiliencePolicies?.FundingStreamPaymentDatesRepository, nameof(resiliencePolicies.FundingStreamPaymentDatesRepository));
            Guard.ArgumentNotNull(logger, nameof(logger));

            _fundingStreamPaymentDates = fundingStreamPaymentDates;
            _resilience = resiliencePolicies.FundingStreamPaymentDatesRepository;
            _logger     = logger;
            _csvUtils   = csvUtils;
        }
コード例 #9
0
        public void SetUp()
        {
            _calculationResultsRepository = Substitute.For <ICalculationResultsRepository>();
            _blobClient              = Substitute.For <IBlobClient>();
            _csvUtils                = Substitute.For <ICsvUtils>();
            _transformation          = Substitute.For <IProviderResultsToCsvRowsTransformation>();
            _cloudBlob               = Substitute.For <ICloudBlob>();
            _fileSystemAccess        = Substitute.For <IFileSystemAccess>();
            _fileSystemCacheSettings = Substitute.For <IFileSystemCacheSettings>();
            _jobManagement           = Substitute.For <IJobManagement>();
            _calcsApiClient          = Substitute.For <ICalculationsApiClient>();
            _specsApiClient          = Substitute.For <ISpecificationsApiClient>();

            _service = new ProviderResultsCsvGeneratorService(Substitute.For <ILogger>(),
                                                              _blobClient,
                                                              _calcsApiClient,
                                                              _specsApiClient,
                                                              _calculationResultsRepository,
                                                              new ResiliencePolicies
            {
                BlobClient              = Policy.NoOpAsync(),
                CalculationsApiClient   = Policy.NoOpAsync(),
                SpecificationsApiClient = Policy.NoOpAsync(),
                ResultsRepository       = Policy.NoOpAsync()
            },
                                                              _csvUtils,
                                                              _transformation,
                                                              _fileSystemAccess,
                                                              _fileSystemCacheSettings,
                                                              _jobManagement);

            _message  = new Message();
            _rootPath = NewRandomString();

            _fileSystemCacheSettings.Path
            .Returns(_rootPath);

            _fileSystemAccess
            .Append(Arg.Any <string>(), Arg.Any <Stream>())
            .Returns(Task.CompletedTask);

            _blobProperties = new BlobProperties();

            _cloudBlob
            .Properties
            .Returns(_blobProperties);
        }
        public PublishedProviderEstateCsvGenerator(
            IJobManagement jobManagement,
            IFileSystemAccess fileSystemAccess,
            IFileSystemCacheSettings fileSystemCacheSettings,
            IBlobClient blobClient,
            IPublishedFundingRepository publishedFundingRepository,
            ICsvUtils csvUtils,
            ILogger logger,
            IPublishedProviderCsvTransformServiceLocator publishedProviderCsvTransformServiceLocator,
            IPublishingResiliencePolicies policies)
            : base(jobManagement, fileSystemAccess, blobClient, policies, csvUtils, logger, fileSystemCacheSettings, publishedProviderCsvTransformServiceLocator)
        {
            Guard.ArgumentNotNull(publishedFundingRepository, nameof(publishedFundingRepository));
            Guard.ArgumentNotNull(policies?.PublishedFundingRepository, nameof(policies.PublishedFundingRepository));

            _publishedFundingRepository       = publishedFundingRepository;
            _publishedFundingRepositoryPolicy = policies.PublishedFundingRepository;
        }
        public ProviderResultsCsvGeneratorService(ILogger logger,
                                                  IBlobClient blobClient,
                                                  ICalculationsApiClient calculationsApiClient,
                                                  ISpecificationsApiClient specificationsApiClient,
                                                  ICalculationResultsRepository resultsRepository,
                                                  IResultsResiliencePolicies policies,
                                                  ICsvUtils csvUtils,
                                                  IProviderResultsToCsvRowsTransformation resultsToCsvRowsTransformation,
                                                  IFileSystemAccess fileSystemAccess,
                                                  IFileSystemCacheSettings fileSystemCacheSettings,
                                                  IJobManagement jobManagement) : base(jobManagement, logger)
        {
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(blobClient, nameof(blobClient));
            Guard.ArgumentNotNull(specificationsApiClient, nameof(specificationsApiClient));
            Guard.ArgumentNotNull(calculationsApiClient, nameof(calculationsApiClient));
            Guard.ArgumentNotNull(resultsRepository, nameof(resultsRepository));
            Guard.ArgumentNotNull(resultsToCsvRowsTransformation, nameof(resultsToCsvRowsTransformation));
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(policies?.BlobClient, nameof(policies.BlobClient));
            Guard.ArgumentNotNull(policies?.CalculationsApiClient, nameof(policies.CalculationsApiClient));
            Guard.ArgumentNotNull(policies?.SpecificationsApiClient, nameof(policies.SpecificationsApiClient));
            Guard.ArgumentNotNull(policies?.ResultsRepository, nameof(policies.ResultsRepository));
            Guard.ArgumentNotNull(fileSystemCacheSettings, nameof(fileSystemCacheSettings));
            Guard.ArgumentNotNull(jobManagement, nameof(jobManagement));

            _logger                         = logger;
            _blobClient                     = blobClient;
            _calculationsApiClient          = calculationsApiClient;
            _specificationsApiClient        = specificationsApiClient;
            _resultsRepository              = resultsRepository;
            _blobClientPolicy               = policies.BlobClient;
            _calculationsApiClientPolicy    = policies.CalculationsApiClient;
            _specificationsApiClientPolicy  = policies.SpecificationsApiClient;
            _resultsRepositoryPolicy        = policies.ResultsRepository;
            _csvUtils                       = csvUtils;
            _resultsToCsvRowsTransformation = resultsToCsvRowsTransformation;
            _fileSystemAccess               = fileSystemAccess;
            _fileSystemCacheSettings        = fileSystemCacheSettings;
            _jobManagement                  = jobManagement;
        }