Пример #1
0
        public void FeedToken_PartitionKey_IsDone()
        {
            PartitionKey          pk    = new PartitionKey("test");
            FeedTokenPartitionKey token = new FeedTokenPartitionKey(pk);

            token.UpdateContinuation(Guid.NewGuid().ToString());
            Assert.IsFalse(token.IsDone);
            token.UpdateContinuation(null);
            Assert.IsTrue(token.IsDone);
        }
        private void FeedToken_PartitionKey_Validate(PartitionKey partitionKey)
        {
            string continuationToken = "TBD";
            FeedTokenPartitionKey feedTokenPartitionKey = new FeedTokenPartitionKey(partitionKey);

            feedTokenPartitionKey.UpdateContinuation(continuationToken);
            string                serialized            = feedTokenPartitionKey.ToString();
            FeedToken             deserialized          = FeedToken.FromString(serialized);
            FeedTokenPartitionKey deserializedFeedToken = deserialized as FeedTokenPartitionKey;

            Assert.IsNotNull(deserialized, "Error deserializing to FeedTokenPartitionKey");
            Assert.AreEqual(feedTokenPartitionKey.PartitionKey.ToJsonString(), deserializedFeedToken.PartitionKey.ToJsonString());
            Assert.AreEqual(continuationToken, deserializedFeedToken.GetContinuation());
        }