예제 #1
0
        static private void TestGoLastPage(SplitePage <StorageLocation> pager)
        {
            var models = pager.MoveLastPage().ToList();

            var result = true;

            for (int i = 0; i < models.Count() - 1; i++)
            {
                if (models[i].ProductName == (pager.CurrentPageNum * pager.PageSize + 1 + i).ToString())
                {
                    continue;
                }
                else
                {
                    result = false;
                }
            }
            if (result)
            {
                Console.WriteLine("进入最后一页-----正确!");
                var totle = new StorageLocationCollection().StorageLocations.Count;
                if (pager.CurrentPageNum == totle / pager.PageSize)
                {
                    Console.WriteLine("最后一页页号-----正确!");
                }
                else
                {
                    Console.WriteLine("最后一页页号----错误!");
                }
            }
            else
            {
                Console.WriteLine("进入最后一页-----错误!");
            }
        }
예제 #2
0
        static private void TestRemainderItems(SplitePage <StorageLocation> pager)
        {
            var totle = new StorageLocationCollection().StorageLocations.Count;

            while ((totle / pager.PageSize) > 0)
            {
                totle -= pager.PageSize;
                pager.MoveNextPage();
            }
            totle = new StorageLocationCollection().StorageLocations.Count;
            var lastLength = totle - pager.CurrentPageNum * pager.PageSize;

            if (lastLength == totle % pager.PageSize)
            {
                Console.WriteLine("进入最后一页-----正确!");
            }
            else
            {
                Console.WriteLine("进入最后一页------失败!");
            }

            var pagerNum = pager.CurrentPageNum;
            var items    = pager.MoveNextPage();

            if (items.Count() == 0)
            {
                Console.WriteLine("最后一页下一页为空-----正确!");
                if (pagerNum == pager.CurrentPageNum)
                {
                    Console.WriteLine("最后一页为空当前页码不变------正确!");
                }
                else
                {
                    Console.WriteLine("最后一页为空当前页码不变------失败!");
                }
            }
            else
            {
                Console.WriteLine("最后一页下一页为空----失败!");
            }


            pagerNum = pager.CurrentPageNum;
            items    = pager.MoveNextPage();
            if (pagerNum == pager.CurrentPageNum)
            {
                Console.WriteLine("第二次最后一页为空当前页码不变------正确!");
            }
            else
            {
                Console.WriteLine("第二次最后一页为空当前页码不变-----失败!");
            }
        }