Example #1
0
        public void ChangeFeedRequestOptions_DefaultValues()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual(ChangeFeedRequestOptions.IfNoneMatchAllHeaderValue, request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
        public void ChangeFeedRequestOptions_AddsPartitionKeyRangeId()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                FeedRange = new FeedRangePartitionKeyRange("randomPK")
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual(expected: "randomPK", actual: request.PartitionKeyRangeId.PartitionKeyRangeId);
        }
Example #3
0
        public void ChangeFeedRequestOptions_AddsStartTime()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                StartTime = new DateTime(1985, 1, 1, 0, 0, 0, DateTimeKind.Utc)
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual("Tue, 01 Jan 1985 00:00:00 GMT", request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
            Assert.IsNull(request.Headers.IfNoneMatch);
        }
Example #4
0
        public void ChangeFeedRequestOptions_ContinuationIsSet()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
            };

            ChangeFeedRequestOptions.FillContinuationToken(request, "something");
            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual("something", request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
        public void ChangeFeedRequestOptions_StartFromBeginning()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                StartTime = DateTime.MinValue.ToUniversalTime()
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.IsNull(request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
        public void ChangeFeedRequestOptions_StartFromBeginning()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                From = ChangeFeedRequestOptions.StartFrom.CreateFromBeginning(),
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.IsNull(request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
        public void ChangeFeedRequestOptions_ContinuationIsSet()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                From = ChangeFeedRequestOptions.StartFrom.CreateFromContinuation("something"),
            };

            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual(expected: "something", actual: request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
Example #8
0
        public void ChangeFeedRequestOptions_MaxItemSizeIsSet()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
            };

            ChangeFeedRequestOptions.FillMaxItemCount(request, 10);
            requestOptions.PopulateRequestOptions(request);

            Assert.AreEqual("10", request.Headers[Documents.HttpConstants.HttpHeaders.PageSize]);
            Assert.AreEqual(ChangeFeedRequestOptions.IfNoneMatchAllHeaderValue, request.Headers.IfNoneMatch);
            Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
        }
        public void ChangeFeedRequestOptions_MaxItemSizeIsSet()
        {
            RequestMessage           request        = new RequestMessage();
            ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions()
            {
                MaxItemCount = 10,
                From         = ChangeFeedRequestOptions.StartFrom.CreateFromBeginning(),
            };

            requestOptions.PopulateRequestOptions(request);

            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_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]);
        }