BuildNextPageLink() public method

public BuildNextPageLink ( ) : void
return void
        public void Can_Build_Next_Page_Tag_For_Page_Lesser_Than_Last_Page()
        {
            var mockPagedResult = new Mock<PagedResultBase>();
            mockPagedResult.SetupGet(c => c.PageNumber).Returns(2).Verifiable();
            mockPagedResult.SetupGet(c => c.Pages).Returns(3).Verifiable();

            PagedResultBase pagedResult = mockPagedResult.Object;

            PaginationBuilder builder = new DefaultPaginationBuilder(pagedResult,
                                                                     (pages, index) =>
                                                                     string.Format("/Controller/Action/{0}/{1}", pages,
                                                                                   index));
            builder.BuildNextPageLink();

            var nextPage = builder.Pagination.FirstOrDefault();

            Assert.That(nextPage, Is.Not.Null
                                       .And
                                       .TypeOf<NextPage>());

            mockPagedResult.Verify();
        }
        public void When_Building_Next_Page_Tag_For_Page_Index_Equals_Last_Page_It_Will_Not_Be_Builded()
        {
            var mockPagedResult = new Mock<PagedResultBase>();
            mockPagedResult.SetupGet(c => c.PageNumber).Returns(3).Verifiable();
            mockPagedResult.SetupGet(c => c.Pages).Returns(3).Verifiable();

            PagedResultBase pagedResult = mockPagedResult.Object;

            PaginationBuilder builder = new DefaultPaginationBuilder(pagedResult,
                                                                     (pages, index) =>
                                                                     string.Format("/Controller/Action/{0}/{1}", pages,
                                                                                   index));
            builder.BuildNextPageLink();

            var nextPage = builder.Pagination.FirstOrDefault();

            Assert.That(nextPage, Is.Null);

            mockPagedResult.Verify();
        }
        public void Build_Next_Page_Tag_For_10_Items_Per_Page_Must_Return_10_Item_Per_Page_On_Url()
        {
            var mockPagedResult = new Mock<PagedResultBase>();
            mockPagedResult.SetupGet(c => c.PageNumber).Returns(1).Verifiable();
            mockPagedResult.SetupGet(c => c.Pages).Returns(2).Verifiable();
            mockPagedResult.SetupGet(c => c.ItemsPerPage).Returns(10).Verifiable();

            PagedResultBase pagedResult = mockPagedResult.Object;

            PaginationBuilder builder = new DefaultPaginationBuilder(pagedResult,
                                                                     (itemPerPage, index) =>
                                                                     string.Format("/Controller/Action/{0}/{1}", itemPerPage,
                                                                                   index));
            builder.BuildNextPageLink();

            var nextPage = builder.Pagination.FirstOrDefault();

            Assert.That(nextPage.GetUrl(), Is.EqualTo("/Controller/Action/10/2"));

            mockPagedResult.Verify();
        }