public void Initialize()
        {
            _mapper = new MapperConfiguration(_ =>
            {
                _.AddProfile <ExternalServiceMappingProfile>();
            }).CreateMapper();

            _publishedProviderVersion = NewRandomString();
            _providerId        = NewRandomString();
            _providerVersionId = NewRandomString();

            _publishedFundingRepository = Substitute.For <IPublishedFundingRepository>();
            _providersApiClient         = Substitute.For <IProvidersApiClient>();
            _logger          = Substitute.For <ILogger>();
            _cacheSettings   = Substitute.For <IExternalApiFileSystemCacheSettings>();
            _fileSystemCache = Substitute.For <IFileSystemCache>();

            _publishedProviderRetrievalService = new PublishedProviderRetrievalService(
                _publishedFundingRepository,
                PublishingResilienceTestHelper.GenerateTestPolicies(),
                _providersApiClient,
                _logger,
                _mapper,
                _cacheSettings,
                _fileSystemCache);
        }
Example #2
0
 public CalculationsService CreateCalculationsService(
     ICalculationsApiClient calculationsApiClient = null,
     ILogger logger = null)
 {
     return(new CalculationsService(
                calculationsApiClient ?? CreateCalculationsApiClient(),
                PublishingResilienceTestHelper.GenerateTestPolicies(),
                logger ?? CreateLogger()));
 }
Example #3
0
        private static PublishedProviderVersioningService CreateVersioningService(
            ILogger logger = null,
            IVersionRepository <PublishedProviderVersion> versionRepository         = null,
            IVersionBulkRepository <PublishedProviderVersion> versionBulkRepository = null)
        {
            IConfiguration configuration = Substitute.For <IConfiguration>();

            return(new PublishedProviderVersioningService(
                       logger ?? CreateLogger(),
                       versionRepository ?? CreateVersionRepository(),
                       PublishingResilienceTestHelper.GenerateTestPolicies(),
                       new PublishingEngineOptions(configuration),
                       versionBulkRepository ?? CreateVersionBulkRepository()));
        }