public SpecificationIndexingService(IJobManagement jobs,
                                            ILogger logger,
                                            ISpecificationIndexer indexer,
                                            ISpecificationsRepository specifications,
                                            ISpecificationsResiliencePolicies resiliencePolicies) : base(jobs, logger)
        {
            Guard.ArgumentNotNull(jobs, nameof(jobs));
            Guard.ArgumentNotNull(indexer, nameof(indexer));
            Guard.ArgumentNotNull(specifications, nameof(specifications));
            Guard.ArgumentNotNull(resiliencePolicies?.SpecificationsRepository, nameof(resiliencePolicies.SpecificationsRepository));

            _jobs                 = jobs;
            _indexer              = indexer;
            _specifications       = specifications;
            _specificationsPolicy = resiliencePolicies.SpecificationsRepository;
        }
Example #2
0
        public void SetUp()
        {
            specificationsRepository = CreateSpecificationsRepository();

            policiesApiClient = CreatePoliciesApiClient();
            policiesApiClient.GetFundingPeriods()
            .Returns(new ApiResponse <IEnumerable <FundingPeriod> >(HttpStatusCode.OK, new[]
            {
                new FundingPeriod
                {
                    Id     = ExpectedFundingPeriodId,
                    Period = ExpectedFundingPeriodName
                },
                new FundingPeriod
                {
                    Id     = "FIRST DIFFERENT ID",
                    Period = "A DIFFERENT PERIOD"
                },
                new FundingPeriod
                {
                    Id     = "A DIFFERENT ID",
                    Period = ExpectedFundingPeriodName
                }
            }));

            mapper = CreateMapper();
            mapper.Map <SpecificationSummary>(_specWithFundingPeriodAndFundingStream)
            .Returns(MapSpecification(_specWithFundingPeriodAndFundingStream));
            mapper.Map <SpecificationSummary>(_specWithFundingPeriodAndFundingStream2)
            .Returns(MapSpecification(_specWithFundingPeriodAndFundingStream2));
            mapper.Map <SpecificationSummary>(_specWithNoFundingStream)
            .Returns(MapSpecification(_specWithNoFundingStream));

            _specificationIndexer          = Substitute.For <ISpecificationIndexer>();
            _resultsApiClient              = Substitute.For <IResultsApiClient>();
            _templateVersionChangedHandler = Substitute.For <ISpecificationTemplateVersionChangedHandler>();
        }