public void GetPublishedFundingFromVersion()
        {
            string  fundingStreamId = NewRandomString();
            string  fundingPeriodId = NewRandomString();
            decimal version         = NewRandomInteger();

            ICosmosDbFeedIterator <PublishedFunding> expectedFeed = NewFeedIterator <PublishedFunding>();

            GivenTheFeedIterator(@"SELECT
                              *
                        FROM publishedFunding p
                        WHERE p.documentType = 'PublishedFunding'
                        AND StringToNumber(CONCAT(Tostring(p.content.current.majorVersion), '.', Tostring(p.content.current.minorVersion))) >= @version
                        AND p.content.current.fundingStreamId = @fundingStreamId
                        AND p.content.current.fundingPeriod.id = @fundingPeriodId
                        AND p.deleted = false",
                                 expectedFeed,
                                 ("@fundingPeriodId", fundingPeriodId),
                                 ("@fundingStreamId", fundingStreamId),
                                 ("@version", version));

            ICosmosDbFeedIterator <PublishedFunding> actualFeedIterator = _repository.GetPublishedFundingFromVersion(fundingStreamId,
                                                                                                                     fundingPeriodId,
                                                                                                                     version);

            actualFeedIterator
            .Should()
            .BeSameAs(expectedFeed);
        }
Exemple #2
0
        public async Task GetPublishedFundingFromVersion()
        {
            ICosmosDbFeedIterator <PublishedFunding> feed = _repository.GetPublishedFundingFromVersion("DSG",
                                                                                                       "FY-2021",
                                                                                                       4M);

            feed.HasMoreResults
            .Should()
            .BeTrue();

            IEnumerable <PublishedFunding> documents = await feed.ReadNext();

            documents
            .Should()
            .NotBeEmpty();
        }