static PublishedResultsService CreateResultsService(ILogger logger       = null,
                                                            IMapper mapper       = null,
                                                            ITelemetry telemetry = null,
                                                            ICalculationResultsRepository resultsRepository    = null,
                                                            ISpecificationsRepository specificationsRepository = null,
                                                            IResultsResiliencePolicies resiliencePolicies      = null,
                                                            IPublishedProviderResultsAssemblerService publishedProviderResultsAssemblerService = null,
                                                            IPublishedProviderResultsRepository publishedProviderResultsRepository             = null,
                                                            ICacheProvider cacheProvider = null,
                                                            ISearchRepository <AllocationNotificationFeedIndex> allocationNotificationFeedSearchRepository = null,
                                                            IProfilingApiClient profilingApiClient = null,
                                                            IMessengerService messengerService     = null,
                                                            IVersionRepository <PublishedAllocationLineResultVersion> publishedProviderResultsVersionRepository    = null,
                                                            IPublishedAllocationLineLogicalResultVersionService publishedAllocationLineLogicalResultVersionService = null,
                                                            IFeatureToggle featureToggle = null,
                                                            IJobsApiClient jobsApiClient = null,
                                                            IPublishedProviderResultsSettings publishedProviderResultsSettings = null,
                                                            IProviderChangesRepository providerChangesRepository = null,
                                                            IProviderVariationsService providerVariationsService = null,
                                                            IProviderVariationsStorageRepository providerVariationsStorageRepository = null)
        {
            ISpecificationsRepository specsRepo = specificationsRepository ?? CreateSpecificationsRepository();

            return(new PublishedResultsService(
                       logger ?? CreateLogger(),
                       mapper ?? CreateMapper(),
                       telemetry ?? CreateTelemetry(),
                       resultsRepository ?? CreateResultsRepository(),
                       specsRepo,
                       resiliencePolicies ?? ResultsResilienceTestHelper.GenerateTestPolicies(),
                       publishedProviderResultsAssemblerService ?? CreateResultsAssembler(),
                       publishedProviderResultsRepository ?? CreatePublishedProviderResultsRepository(),
                       cacheProvider ?? CreateCacheProvider(),
                       allocationNotificationFeedSearchRepository ?? CreateAllocationNotificationFeedSearchRepository(),
                       profilingApiClient ?? CreateProfilingRepository(),
                       messengerService ?? CreateMessengerService(),
                       publishedProviderResultsVersionRepository ?? CreatePublishedProviderResultsVersionRepository(),
                       publishedAllocationLineLogicalResultVersionService ?? CreatePublishedAllocationLineLogicalResultVersionService(),
                       featureToggle ?? CreateFeatureToggle(),
                       jobsApiClient ?? CreateJobsApiClient(),
                       publishedProviderResultsSettings ?? CreatePublishedProviderResultsSettings(),
                       providerChangesRepository ?? CreateProviderChangesRepository(),
                       providerVariationsService ?? CreateProviderVariationsService(CreateProviderVariationAssemblerService(), specsRepo),
                       providerVariationsStorageRepository ?? CreateProviderVariationsStorageRepository()
                       ));
        }
예제 #2
0
        public void ConfigureServices_WhenMajorMinorVersioningIsEnabled_RegisterDependenciesCorrectly()
        {
            // Arrange
            IConfigurationRoot configuration = CreateTestConfiguration();
            Startup            target        = new Startup(configuration);

            // Act
            target.ConfigureServices(Services);

            // Assert
            IServiceProvider serviceProvider = target.ServiceProvider;

            IPublishedAllocationLineLogicalResultVersionService service = (IPublishedAllocationLineLogicalResultVersionService)serviceProvider.GetService(typeof(IPublishedAllocationLineLogicalResultVersionService));

            service
            .Should()
            .BeOfType <PublishedAllocationLineLogicalResultVersionService>();
        }