示例#1
0
        public static ChangeFeedCrossFeedRangeState CreateFromContinuation(CosmosElement continuation, FeedRange feedRange)
        {
            if (!(feedRange is FeedRangeInternal feedRangeInternal))
            {
                throw new ArgumentException($"{nameof(feedRange)} needs to be a {nameof(FeedRangeInternal)}.");
            }

            return(new ChangeFeedCrossFeedRangeState(
                       new List <FeedRangeState <ChangeFeedState> >()
            {
                new FeedRangeState <ChangeFeedState>(feedRangeInternal, ChangeFeedState.Continuation(continuation))
            }));
        }
示例#2
0
        public void Continuation()
        {
            CosmosString               continuation  = CosmosString.Create("asdf");
            ChangeFeedState            time          = ChangeFeedState.Continuation(continuation);
            CosmosElement              cosmosElement = ChangeFeedStateCosmosElementSerializer.ToCosmosElement(time);
            TryCatch <ChangeFeedState> monadicState  = ChangeFeedStateCosmosElementSerializer.MonadicFromCosmosElement(cosmosElement);

            Assert.IsTrue(monadicState.Succeeded);
            if (!(monadicState.Result is ChangeFeedStateContinuation changeFeedContinuation))
            {
                Assert.Fail();
                return;
            }

            Assert.AreEqual(changeFeedContinuation.ContinuationToken, continuation);
        }