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

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

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

            ICosmosDbFeedIterator <PublishedFundingVersion> actualFeedIterator = _repository.GetPublishedFundingVersionsFromVersion(fundingStreamId,
                                                                                                                                    fundingPeriodId,
                                                                                                                                    version);

            actualFeedIterator
            .Should()
            .BeSameAs(expectedFeed);
        }
Exemplo n.º 2
0
        public async Task GetPublishedFundingVersionsFromVersion()
        {
            ICosmosDbFeedIterator <PublishedFundingVersion> feed = _repository.GetPublishedFundingVersionsFromVersion("DSG",
                                                                                                                      "FY-2021",
                                                                                                                      2M);

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

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

            documents
            .Should()
            .NotBeEmpty();
        }