Example #1
0
        public async Task SerializationIsExpected()
        {
            List <CompositeContinuationToken> compositeContinuationTokens = new List <CompositeContinuationToken>()
            {
                StandByFeedContinuationTokenTests.BuildTokenForRange("A", "B", "C"),
                StandByFeedContinuationTokenTests.BuildTokenForRange("D", "E", "F")
            };

            string expected = JsonConvert.SerializeObject(compositeContinuationTokens);

            List <Documents.PartitionKeyRange> keyRanges = new List <Documents.PartitionKeyRange>()
            {
                new Documents.PartitionKeyRange()
                {
                    MinInclusive = "A", MaxExclusive = "B"
                },
                new Documents.PartitionKeyRange()
                {
                    MinInclusive = "D", MaxExclusive = "E"
                },
            };
            StandByFeedContinuationToken compositeToken = await StandByFeedContinuationToken.CreateAsync(StandByFeedContinuationTokenTests.ContainerRid, null, CreateCacheFromRange(keyRanges));

            (CompositeContinuationToken token, string rangeId) = await compositeToken.GetCurrentTokenAsync();

            token.Token = "C";
            compositeToken.MoveToNextToken();
            (CompositeContinuationToken token2, string rangeId2) = await compositeToken.GetCurrentTokenAsync();

            token2.Token = "F";
            compositeToken.MoveToNextToken();

            Assert.AreEqual(expected, compositeToken.ToString());
        }