public async Task All_WhereSpecification() { var soh = new SalesOrderHeader(); var allRows = await(await soh.AllAsync(where : "WHERE CustomerId=@0", args: 30052)).ToListAsync(); Assert.AreEqual(4, allRows.Count); }
public async Task All_LimitSpecification() { var soh = new SalesOrderHeader(); var allRows = await(await soh.AllAsync(limit: 10)).ToListAsync(); Assert.AreEqual(10, allRows.Count); }
public async Task All_NoParameters() { var soh = new SalesOrderHeader(); var allRows = await(await soh.AllAsync()).ToListAsync(); Assert.AreEqual(31465, allRows.Count); }
public async Task All_NoParameters_Streaming() { var soh = new SalesOrderHeader(); var allRows = await soh.AllAsync(); var count = 0; await allRows.ForEachAsync(r => { count++; Assert.AreEqual(26, ((IDictionary <string, object>)r).Count); // # of fields fetched should be 26 }); Assert.AreEqual(31465, count); }
public async Task All_WhereSpecification_ColumnsSpecification_LimitSpecification() { var soh = new SalesOrderHeader(); var allRows = await(await soh.AllAsync(limit: 2, columns: "SalesOrderID as SOID, Status, SalesPersonID", where : "WHERE CustomerId=@0", args: 30052)).ToListAsync(); Assert.AreEqual(2, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("SOID")); Assert.IsTrue(firstRow.ContainsKey("Status")); Assert.IsTrue(firstRow.ContainsKey("SalesPersonID")); }
public async Task AllAsync_ColumnSpecification() { var soh = new SalesOrderHeader(); var allRows = await soh.AllAsync(columns : "SalesOrderID as SOID, Status, SalesPersonID"); Assert.AreEqual(31465, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("SOID")); Assert.IsTrue(firstRow.ContainsKey("Status")); Assert.IsTrue(firstRow.ContainsKey("SalesPersonID")); }
public async Task All_ColumnSpecification() { // specify columns a different way to cause a cache miss var soh = new SalesOrderHeader(columns: "SalesOrderID as SOID, Status, SalesPersonID"); var allRows = await(await soh.AllAsync()).ToListAsync(); Assert.AreEqual(31465, allRows.Count); var firstRow = (IDictionary <string, object>)allRows[0]; Assert.AreEqual(3, firstRow.Count); Assert.IsTrue(firstRow.ContainsKey("SOID")); Assert.IsTrue(firstRow.ContainsKey("Status")); Assert.IsTrue(firstRow.ContainsKey("SalesPersonID")); }
public async Task All_WhereSpecification_OrderBySpecification() { var soh = new SalesOrderHeader(); 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 SalesOrderHeader(); 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; } }