Example #1
0
        public void GetNextPageLink_GetsNextPageLink(string requestUri, int pageSize, string nextPageUri)
        {
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUri);

            Uri nextPageLink = ODataQueryOptions.GetNextPageLink(request, pageSize);

            Assert.Equal(nextPageUri, nextPageLink.AbsoluteUri);
        }
Example #2
0
        public void GetNextPageLink_WithRelativeUri_Throws()
        {
            Uri relativeUri = new Uri("/test", UriKind.Relative);
            HttpRequestMessage requestWithRelativeUri = new HttpRequestMessage()
            {
                RequestUri = relativeUri
            };

            Assert.Throws <ArgumentException>(() => { ODataQueryOptions.GetNextPageLink(requestWithRelativeUri, 10); });
        }
Example #3
0
        public void GetNextPageLink_WithNullRequestOrUri_Throws()
        {
            HttpRequestMessage nullRequest = null;

            Assert.Throws <ArgumentNullException>(() => { ODataQueryOptions.GetNextPageLink(nullRequest, 10); });

            HttpRequestMessage requestWithNullUri = new HttpRequestMessage()
            {
                RequestUri = null
            };

            Assert.Throws <ArgumentNullException>(() => { ODataQueryOptions.GetNextPageLink(requestWithNullUri, 10); });
        }
Example #4
0
        public void GetNextPageLink_ThatTakesUri_GetsNextPageLink()
        {
            Uri nextPageLink = ODataQueryOptions.GetNextPageLink(new Uri("http://localhost/Customers?$filter=Age ge 18"), 10);

            Assert.Equal("http://localhost/Customers?$filter=Age%20ge%2018&$skip=10", nextPageLink.AbsoluteUri);
        }