Exemplo n.º 1
0
        public void GetDefaultPagedList_NoCount(int pageIndex)
        {
            var option = Options.Create(new PagerSetupOption
            {
                StartPageIndex  = pageIndex,
                DefaultPageSize = 10
            });

            var pager       = new PagerService(option);
            var orderedData = _list.AsQueryable().OrderBy(x => x.Seq);
            var rs          = pager.GetPagedList(orderedData, false);

            Assert.Equal(-1, rs.RecordCount);
            Assert.Equal(-1, rs.PageCount);
            Assert.Equal(orderedData.First().Seq, rs.Data.First().Seq);
        }
Exemplo n.º 2
0
        public void GetDefaultPagedList_OutRange(int pageIndex)
        {
            var option = Options.Create(new PagerSetupOption
            {
                StartPageIndex  = pageIndex,
                DefaultPageSize = 10
            });

            var pager       = new PagerService(option);
            var orderedData = _list.AsQueryable().OrderBy(x => x.Seq);
            var rs          = pager.GetPagedList(orderedData, new PagerParams
            {
                PageIndex = pageIndex + 12,
                PageSize  = 10
            });

            Assert.Equal(100, rs.RecordCount);
            Assert.Equal(10, rs.PageCount);
            Assert.Empty(rs.Data);
        }