public void TestMatchRangesTocontinuationTokens_OneToNone()
        {
            PartitionKeyRange partitionKeyRange = new PartitionKeyRange()
            {
                MinInclusive = string.Empty,
                MaxExclusive = "A",
                Id           = "1"
            };

            ParallelContinuationToken token = new ParallelContinuationToken(
                token: "asdf",
                range: new Documents.Routing.Range <string>(
                    min: "B",
                    max: "C",
                    isMinInclusive: true,
                    isMaxInclusive: false));

            IReadOnlyDictionary <PartitionKeyRange, IPartitionedToken> expectedMapping = new Dictionary <PartitionKeyRange, IPartitionedToken>()
            {
                { partitionKeyRange, null },
            };

            ContinuationResumeLogicTests.RunMatchRangesToContinuationTokens(
                expectedMapping,
                new PartitionKeyRange[] { partitionKeyRange },
                new ParallelContinuationToken[] { token });
        }
        public void TestMatchRangesTocontinuationTokens_OneToMany()
        {
            FeedRangeEpk partitionKeyRange1 = new FeedRangeEpk(
                new Documents.Routing.Range <string>(
                    min: string.Empty,
                    max: "A",
                    isMinInclusive: true,
                    isMaxInclusive: false));

            FeedRangeEpk partitionKeyRange2 = new FeedRangeEpk(
                new Documents.Routing.Range <string>(
                    min: "A",
                    max: "B",
                    isMinInclusive: true,
                    isMaxInclusive: false));

            ParallelContinuationToken token = new ParallelContinuationToken(
                token: "asdf",
                range: new Documents.Routing.Range <string>(
                    min: string.Empty,
                    max: "B",
                    isMinInclusive: true,
                    isMaxInclusive: false));

            IReadOnlyDictionary <FeedRangeEpk, IPartitionedToken> expectedMapping = new Dictionary <FeedRangeEpk, IPartitionedToken>()
            {
                { partitionKeyRange1, token },
                { partitionKeyRange2, token }
            };

            ContinuationResumeLogicTests.RunMatchRangesToContinuationTokens(
                expectedMapping,
                new FeedRangeEpk[] { partitionKeyRange1, partitionKeyRange2 },
                new ParallelContinuationToken[] { token });
        }
 public void TestMatchRangesTocontinuationTokens_ArgumentNullException()
 {
     ContinuationResumeLogicTests.RunMatchRangesToContinuationTokens(
         expectedMapping: null,
         partitionKeyRanges: new PartitionKeyRange[] { },
         partitionedTokens: null);
 }
        public void TestMatchRangesTocontinuationTokens_OneToOne()
        {
            PartitionKeyRange partitionKeyRange = new PartitionKeyRange()
            {
                MinInclusive = string.Empty,
                MaxExclusive = "FF",
                Id           = "0"
            };

            CompositeContinuationToken token = new CompositeContinuationToken()
            {
                Range = new Documents.Routing.Range <string>(
                    min: string.Empty,
                    max: "FF",
                    isMinInclusive: true,
                    isMaxInclusive: false),
                Token = "asdf"
            };

            IReadOnlyDictionary <PartitionKeyRange, IPartitionedToken> expectedMapping = new Dictionary <PartitionKeyRange, IPartitionedToken>()
            {
                { partitionKeyRange, token }
            };

            ContinuationResumeLogicTests.RunMatchRangesToContinuationTokens(
                expectedMapping,
                new PartitionKeyRange[] { partitionKeyRange },
                new CompositeContinuationToken[] { token });
        }