示例#1
0
        public void TestCurrentPageNoGivenPageNoInQueryStringIsEmpty()
        {
            var pagination = new DfcPagination("testUrl/?OtherParam=123&PageNo=&Param=567", 100, 5, "PageNo", true);
            var pageNo     = pagination.CurrentPageNo;

            Assert.True(pageNo == 1);
        }
示例#2
0
        public void TestCurrentPageNoGivenNoPageNoInQueryString()
        {
            var pagination = new DfcPagination("testUrl", 100, 5, "PageNo", true);
            var pageNo     = pagination.CurrentPageNo;

            Assert.True(pageNo == 1);
        }
示例#3
0
        public void TestPreviousAnchorGivenCurrentPageNoLessThanOne()
        {
            var expected   = string.Empty;
            var pagination = new DfcPagination("testUrl/?testParam=0", 100, 5, "testParam", true);
            var actual     = pagination.PreviousAnchor();

            expected.IsSame(actual);
        }
示例#4
0
        public void TestPreviousAnchor()
        {
            var expected   = "<a href=\"http://testurl:80/?testParam=9\" class=\"pagination-item pagination-previous\">Previous</a>";
            var pagination = new DfcPagination("testUrl/?testParam=10", 100, 5, "testParam", true);
            var actual     = pagination.PreviousAnchor();

            expected.IsSame(actual);
        }
示例#5
0
        public void TestGetUrlWithPageNoGivenExistingQueryStringWithExpectedParam()
        {
            const string expected   = "http://testurl:80/?otherParam=567&testParam=155";
            var          pagination = new DfcPagination("testUrl/?otherParam=567&testParam=1", 100, 5, "testParam", true);
            var          actual     = pagination.GetUrlWithPageNo(155);

            expected.IsSame(actual);
        }
示例#6
0
        public void TestGetUrlWithPageNoGivenNoQueryString()
        {
            const string expected   = "http://testurl:80/?testParam=155";
            var          pagination = new DfcPagination("testUrl", 100, 5, "testParam", true);
            var          actual     = pagination.GetUrlWithPageNo(155);

            expected.IsSame(actual);
        }
示例#7
0
        public void TestNextAnchorGivenCurrentPageNoGreaterThanNoOfPages()
        {
            var expected   = string.Empty;
            var pagination = new DfcPagination("testUrl/?testParam=11", 10, 5, "testParam", true);
            var actual     = pagination.NextAnchor();

            expected.IsSame(actual);
        }
示例#8
0
        public void TestNextAnchor()
        {
            var expected   = "<a href=\"http://testurl:80/?testParam=11\" class=\"pagination-item pagination-next\">Next</a>";
            var pagination = new DfcPagination("testUrl/?testParam=10", 100, 5, "testParam", true);
            var actual     = pagination.NextAnchor();

            expected.IsSame(actual);
        }
示例#9
0
        public void TestConstructor()
        {
            var actual = new DfcPagination("testUrl", 100, 5, "testParam", true);

            Assert.True(actual.Slide == true);
            Assert.True(actual.Url == "testUrl");
            Assert.True(actual.NoOfPages == 100);
            Assert.True(actual.DisplayNoOfPages == 5);
            Assert.True(actual.ParamName == "testParam");
        }