Exemple #1
0
        public void Can_generate_paged_result_with_path()
        {
            string       expectedUrl   = _baseUrl + "paging/2?currentpagenumber=0";
            const string routeName     = "page.path";
            const string routeTemplate = "paging/{page}";

            PagingResult result = PagingTestHelper.CreateAPagingGenerator(_baseUrl, routeName, routeTemplate)
                                  .Generate(routeName, new Request {
                page = 1
            }, PagedList);

            Assert.True(result.HasNext);
            Assert.Equal(expectedUrl, result.NextUrl);
        }
Exemple #2
0
        public void Can_generate_paged_result_with_previous_url()
        {
            string       expectedUrl   = _baseUrl + "paging/0?page=1";
            const string routeName     = "newPage.path";
            const string routeTemplate = "paging/{currentPageNumber}";

            PagingResult result = PagingTestHelper.CreateAPagingGenerator(_baseUrl, routeName, routeTemplate)
                                  .Generate(routeName, new Request {
                page = 1
            }, PagedList.ToPagedList(2, 10));

            Assert.True(result.HasPrevious);
            Assert.Equal(expectedUrl, result.PreviousUrl);
        }
Exemple #3
0
        public void Can_generate_paged_result_with_path_and_nullable_page_expression()
        {
            string       expectedUrl   = _baseUrl + "paging/2?page=1";
            const string routeName     = "newPage.path";
            const string routeTemplate = "paging/{currentPageNumber}";

            PagingResult result = PagingTestHelper.CreateAPagingGenerator(_baseUrl, routeName, routeTemplate)
                                  .Generate(routeName, new RequestNullable {
                page = 1
            }, PagedList, x => x.currentPageNumber);

            Assert.True(result.HasNext);
            Assert.Equal(expectedUrl, result.NextUrl);
        }
Exemple #4
0
        public void Can_generate_paged_result_with_query_string_and_page_expression()
        {
            string       expectedUrl   = _baseUrl + "paging?page=1&currentpagenumber=2";
            const string routeName     = "page.query";
            const string routeTemplate = "paging";

            PagingResult result = PagingTestHelper.CreateAPagingGenerator(_baseUrl, routeName, routeTemplate)
                                  .Generate(routeName, new Request {
                page = 1
            }, PagedList, x => x.currentPageNumber);

            Assert.True(result.HasNext);
            Assert.False(result.HasPrevious);
            Assert.Equal(expectedUrl, result.NextUrl);
        }
Exemple #5
0
        public void Can_generate_paged_result_with_query_string_using_object_like_IPagedTarget()
        {
            string       expectedUrl   = _baseUrl + "paging?page=2&currentpagenumber=0";
            const string routeName     = "page.query";
            const string routeTemplate = "paging";

            PagingResult result = PagingTestHelper.CreateAPagingGenerator(_baseUrl, routeName, routeTemplate)
                                  .Generate(routeName, new Request {
                page = 1
            }, new OurPagedList());

            Assert.True(result.HasNext);
            Assert.False(result.HasPrevious);
            Assert.Equal(expectedUrl, result.NextUrl);
        }