예제 #1
0
        public void Paged_WhereSpecification()
        {
            var soh       = new SalesOrderHeaders();
            var page3     = soh.Paged(currentPage: 3, where : "SalesOrderNumber LIKE @0", args: "SO4%");
            var pageItems = page3.Items.ToList();

            Assert.AreEqual(20, pageItems.Count);
            Assert.AreEqual(6341, page3.TotalRecords);
        }
예제 #2
0
        public void Paged_NoSpecification()
        {
            var soh = new SalesOrderHeaders();
            // no order by, and paged queries logically must have an order by; this will order on PK
            var page2     = soh.Paged(currentPage: 2, pageSize: 30);
            var pageItems = page2.Items.ToList();

            Assert.AreEqual(30, pageItems.Count);
            Assert.AreEqual(31465, page2.TotalRecords);
        }
예제 #3
0
        public void Paged_OrderBySpecification_ColumnsSpecification()
        {
            var soh       = new SalesOrderHeaders();
            var page2     = soh.Paged(columns: "CustomerID, SalesOrderID", orderBy: "CustomerID DESC", currentPage: 2, pageSize: 30);
            var pageItems = page2.Items.ToList();

            Assert.AreEqual(30, pageItems.Count);
            Assert.AreEqual(31465, page2.TotalRecords);
            int previous = int.MaxValue;

            foreach (var r in pageItems)
            {
                int current = r.CustomerID;
                Assert.IsTrue(current <= previous);
                previous = current;
            }
        }