Ejemplo n.º 1
0
 public async Task Paged_WhereSpecification()
 {
     var soh = new SalesOrderHeaders();
     var page3 = await soh.PagedAsync(currentPage: 3, where: "SalesOrderNumber LIKE @0", args: "SO4%");
     var pageItems = page3.Items.ToList();
     Assert.AreEqual(20, pageItems.Count);
     Assert.AreEqual(6341, page3.TotalRecords);
 }
Ejemplo n.º 2
0
 public async Task 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 = await soh.PagedAsync(currentPage:2, pageSize: 30);
     var pageItems = page2.Items.ToList();
     Assert.AreEqual(30, pageItems.Count);
     Assert.AreEqual(31465, page2.TotalRecords);
 }
Ejemplo n.º 3
0
 public async Task Paged_OrderBySpecification_ColumnsSpecification()
 {
     var soh = new SalesOrderHeaders();
     var page2 = await soh.PagedAsync(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;
     }
 }