public async Task StartFromBeginingTestAsync() { IDocumentContainer documentContainer = await this.CreateDocumentContainerAsync(numItems : 10); List <FeedRangeEpk> ranges = await documentContainer.GetFeedRangesAsync(NoOpTrace.Singleton, cancellationToken : default); // Should get back the all the documents inserted so far ChangeFeedState resumeState; { TryCatch <ChangeFeedPage> monadicChangeFeedPage = await documentContainer.MonadicChangeFeedAsync( ChangeFeedState.Beginning(), ranges[0], pageSize : int.MaxValue, trace : NoOpTrace.Singleton, cancellationToken : default); Assert.IsTrue(monadicChangeFeedPage.Succeeded); resumeState = monadicChangeFeedPage.Result.State; } // No more changes left { TryCatch <ChangeFeedPage> monadicChangeFeedPage = await documentContainer.MonadicChangeFeedAsync( resumeState, ranges[0], pageSize : 10, trace : NoOpTrace.Singleton, cancellationToken : default); Assert.IsTrue(monadicChangeFeedPage.Succeeded); Assert.IsTrue(monadicChangeFeedPage.Result is ChangeFeedNotModifiedPage); } }
public async Task EmptyContainerTestAsync() { IDocumentContainer documentContainer = await this.CreateDocumentContainerAsync(numItems : 0); List <FeedRangeEpk> ranges = await documentContainer.GetFeedRangesAsync(NoOpTrace.Singleton, cancellationToken : default); TryCatch <ChangeFeedPage> monadicChangeFeedPage = await documentContainer.MonadicChangeFeedAsync( ChangeFeedState.Beginning(), ranges[0], pageSize : 10, trace : NoOpTrace.Singleton, cancellationToken : default); Assert.IsTrue(monadicChangeFeedPage.Succeeded); Assert.IsTrue(monadicChangeFeedPage.Result is ChangeFeedNotModifiedPage); }