public async Task WhenPublishedProvidersRequestedAndPublishedProvidersExistForSpecificationPublishedProvidersReturned()
        {
            Provider successor = NewProvider();
            IEnumerable <PublishedProvider> publishedProviders = new[] {
                NewPublishedProvider(_ => _.WithCurrent(NewPublishedProviderVersion(ppv => ppv.WithProvider(NewProvider())))),
                NewPublishedProvider(_ => _.WithCurrent(NewPublishedProviderVersion(ppv => ppv.WithProvider(NewProvider())))),
                NewPublishedProvider(_ => _.WithCurrent(NewPublishedProviderVersion(ppv => ppv.WithProvider(NewProvider(p => p.WithSuccessor(successor.ProviderId))))))
            };

            IEnumerable <ApiProvider> apiproviders = _mapper.Map <IEnumerable <ApiProvider> >(publishedProviders.Select(_ => _.Current.Provider));

            ApiProvider excludedProvider = _mapper.Map <ApiProvider>(NewProvider());

            apiproviders = apiproviders.Concat(new[] { excludedProvider });

            publishedProviders = publishedProviders.Concat(new[] { NewPublishedProvider(_ => _.WithCurrent(NewPublishedProviderVersion(ppv => ppv.WithProvider(successor)))) });

            string providerVersionId           = NewRandomString();
            string specificationId             = NewRandomString();
            SpecificationSummary specification = new SpecificationSummary {
                Id            = specificationId,
                FundingPeriod = new Reference {
                    Id = FundingPeriodId
                },
                ProviderVersionId = providerVersionId
            };

            GivenTheApiResponseProviderVersionContainsTheProviders(providerVersionId, apiproviders.ToArray());

            AndPublishedProvidersForFundingStreamAndFundingPeriod(publishedProviders);

            AndTheSecondApiResponseScopedProviderIdsContainsProviderIds(specificationId, apiproviders.Select(_ => _.ProviderId));

            _jobManagement
            .QueueJobAndWait(Arg.Any <Func <Task <bool> > >(), JobConstants.DefinitionNames.PopulateScopedProvidersJob, specificationId, Arg.Any <string>(), ServiceBusConstants.TopicNames.JobNotifications)
            .Returns(true);

            (IDictionary <string, PublishedProvider> PublishedProvidersForFundingStream,
             IDictionary <string, PublishedProvider> ScopedPublishedProviders) = await WhenPublishedProvidersAreReturned(specification);

            PublishedProvidersForFundingStream.Count()
            .Should()
            .Be(4);

            PublishedProvidersForFundingStream.Keys
            .Should()
            .BeEquivalentTo(publishedProviders.Select(_ => _.Current.ProviderId));

            ScopedPublishedProviders.Count()
            .Should()
            .Be(4);

            ScopedPublishedProviders.Keys
            .Should()
            .BeEquivalentTo(publishedProviders.Select(_ => _.Current.ProviderId));
        }
コード例 #2
0
        public void SetUp()
        {
            _templateVersion          = NewRandomString();
            _publishedProviderVersion = CreateProviderVersion(_templateVersion);
            _generatedProviderResult  = CreateGeneratedProviderResult();
            _provider = CreateProvider();
            _publishedProviderVersionForMapping = (PublishedProviderVersion)_publishedProviderVersion.Clone();

            _mapper = CreateMapper();
            _mapper
            .Map <Provider>(_provider)
            .Returns(_publishedProviderVersionForMapping.Provider);

            _logger = CreateLogger();

            _publishedProviderDataPopulator = new PublishedProviderDataPopulator(_mapper, _logger);
        }