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); }
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); }
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; } }