public void ChangeFeedRequestOptions_StartFromBeginning() { RequestMessage request = new RequestMessage(); ChangeFeedStartFromRequestOptionPopulator visitor = new ChangeFeedStartFromRequestOptionPopulator(request); ChangeFeedStartFrom.Beginning().Accept(visitor); Assert.IsNull(request.Headers.IfNoneMatch); Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]); }
public void ChangeFeedRequestOptions_MaxItemSizeIsSet() { RequestMessage request = new RequestMessage(); ChangeFeedStartFromRequestOptionPopulator visitor = new ChangeFeedStartFromRequestOptionPopulator(request); ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions() { PageSizeHint = 10, }; requestOptions.PopulateRequestOptions(request); ChangeFeedStartFrom.Beginning().Accept(visitor); Assert.AreEqual(expected: "10", actual: request.Headers[Documents.HttpConstants.HttpHeaders.PageSize]); Assert.IsNull(request.Headers.IfNoneMatch); Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]); }
public void ChangeFeedRequestOptions_AddsFeedRange() { FeedRange feedRange = new FeedRangePartitionKeyRange("randomPK"); ChangeFeedStartFrom[] froms = new ChangeFeedStartFrom[] { ChangeFeedStartFrom.Beginning(feedRange), ChangeFeedStartFrom.Now(feedRange), ChangeFeedStartFrom.Time(DateTime.MinValue.ToUniversalTime(), feedRange) }; foreach (ChangeFeedStartFrom from in froms) { RequestMessage request = new RequestMessage(); ChangeFeedStartFromRequestOptionPopulator visitor = new ChangeFeedStartFromRequestOptionPopulator(request); from.Accept(visitor); Assert.AreEqual( expected: "randomPK", actual: request.PartitionKeyRangeId.PartitionKeyRangeId); } }