public async Task All_LimitSpecification() { var soh = new SalesOrderHeaders(); var allRows = await(await soh.AllAsync(limit: 10)).ToListAsync(); Assert.AreEqual(10, allRows.Count); }
public async Task All_NoParameters_Streaming() { var soh = new SalesOrderHeaders(); var allRows = await soh.AllAsync(); var count = 0; int nonZeroSalesPersonID = 0; await allRows.ForEachAsync(r => { count++; Assert.Greater(r.SalesOrderID, 0); if (r.SalesPersonID > 0) { nonZeroSalesPersonID++; Assert.AreNotEqual("", r.PurchaseOrderNumber); } else { Assert.Null(r.PurchaseOrderNumber); } Assert.Greater(r.CustomerID, 0); Assert.Greater(r.Status, 0); }); Assert.AreEqual(31465, count); Assert.AreEqual(3806, nonZeroSalesPersonID); }
public async Task All_NoParameters() { var soh = new SalesOrderHeaders(); var allRows = await(await soh.AllAsync()).ToListAsync(); Assert.AreEqual(31465, allRows.Count); }
public async Task All_WhereSpecification() { var soh = new SalesOrderHeaders(); var allRows = await(await soh.AllAsync(where : "WHERE CustomerId=@0", args: 30052)).ToListAsync(); Assert.AreEqual(4, allRows.Count); }
public async Task All_ColumnSpecification() { var soh = new SalesOrderHeaders(); var allRows = await (await soh.AllAsync(columns: "SalesOrderID, Status, SalesPersonID")).ToListAsync(); Assert.AreEqual(31465, allRows.Count); var firstRow = allRows[0]; Assert.Greater(firstRow.SalesOrderID, 0); Assert.AreNotEqual(0, firstRow.Status); Assert.Greater(firstRow.SalesPersonID, 0); }
public async Task All_WhereSpecification_OrderBySpecification() { var soh = new SalesOrderHeaders(); var allRows = await (await soh.AllAsync(orderBy: "SalesOrderID DESC", where: "WHERE CustomerId=@0", args: 30052)).ToListAsync(); Assert.AreEqual(4, allRows.Count); int previous = int.MaxValue; foreach(var r in allRows) { int current = r.SalesOrderID; Assert.IsTrue(current <= previous); previous = current; } }
public async Task All_OrderBySpecification() { var soh = new SalesOrderHeaders(); var allRows = await (await soh.AllAsync(orderBy: "CustomerID DESC")).ToListAsync(); Assert.AreEqual(31465, allRows.Count); int previous = int.MaxValue; foreach(var r in allRows) { int current = r.CustomerID; Assert.IsTrue(current <= previous); previous = current; } }
public async Task All_WhereSpecification_ColumnsSpecification() { var soh = new SalesOrderHeaders(); var allRows = await soh.AllAsync(columns: "SalesOrderID, Status, SalesPersonID", where: "WHERE CustomerId=@0", args: 30052); int count = 0; await allRows.ForEachAsync(item => { Assert.Greater(item.SalesOrderID, 0); Assert.Greater(item.Status, 0); Assert.Greater(item.SalesPersonID, 0); Assert.AreEqual(item.CustomerID, 0); Assert.Null(item.PurchaseOrderNumber); count++; }); Assert.AreEqual(4, count); }
public async Task All_WhereSpecification_ColumnsSpecification_LimitSpecification() { var soh = new SalesOrderHeaders(); var allRows = await (await soh.AllAsync(limit: 2, columns: "SalesOrderID, Status, SalesPersonID", where: "WHERE CustomerId=@0", args: 30052)).ToListAsync(); int count = 0; foreach (var item in allRows) { Assert.Greater(item.SalesOrderID, 0); Assert.Greater(item.Status, 0); Assert.Greater(item.SalesPersonID, 0); Assert.AreEqual(item.CustomerID, 0); Assert.Null(item.PurchaseOrderNumber); count++; } Assert.AreEqual(2, count); }