public void FeedToken_EPK_EnrichRequest() { const string containerRid = "containerRid"; FeedTokenEPKRange token = new FeedTokenEPKRange(containerRid, new Documents.PartitionKeyRange() { MinInclusive = "A", MaxExclusive = "B" }); RequestMessage requestMessage = new RequestMessage(); token.EnrichRequest(requestMessage); Assert.AreEqual(token.CompleteRange.Min, requestMessage.Properties[HandlerConstants.StartEpkString]); Assert.AreEqual(token.CompleteRange.Max, requestMessage.Properties[HandlerConstants.EndEpkString]); Assert.ThrowsException <ArgumentNullException>(() => token.EnrichRequest(null)); }
public void IsFeedOperation_ForFeedTokenEPKRange() { RequestMessage request = new RequestMessage(); request.OperationType = OperationType.ReadFeed; request.ResourceType = ResourceType.Document; FeedTokenInternal feedTokenEPKRange = new FeedTokenEPKRange(Guid.NewGuid().ToString(), new PartitionKeyRange() { MinInclusive = "AA", MaxExclusive = "BB", Id = "0" }); feedTokenEPKRange.EnrichRequest(request); Assert.IsTrue(request.IsPartitionKeyRangeHandlerRequired); }
public void FeedToken_EPK_NotEnrichRequest_IfEPKAlreadyExists() { const string containerRid = "containerRid"; string epkString = Guid.NewGuid().ToString(); FeedTokenEPKRange token = new FeedTokenEPKRange(containerRid, new Documents.PartitionKeyRange() { MinInclusive = "A", MaxExclusive = "B" }); RequestMessage requestMessage = new RequestMessage(); requestMessage.Properties[HandlerConstants.StartEpkString] = epkString; requestMessage.Properties[HandlerConstants.EndEpkString] = epkString; token.EnrichRequest(requestMessage); Assert.AreEqual(epkString, requestMessage.Properties[HandlerConstants.StartEpkString]); Assert.AreEqual(epkString, requestMessage.Properties[HandlerConstants.EndEpkString]); }