public void All_LimitSpecification() { var depts = new Department(ProviderName); var allRows = depts.All(limit: 10).ToList(); Assert.AreEqual(10, allRows.Count); }
public void Save_MultipleRows() { var depts = new Department(ProviderName); object[] toSave = new object[] { new { DNAME = "Massive Dep", LOC = "Beach" }.ToExpando(), new { DNAME = "Massive Dep", LOC = "DownTown" }.ToExpando() }; var result = depts.Save(toSave); Assert.AreEqual(2, result); foreach (dynamic o in toSave) { Assert.IsTrue(o.DEPTNO > 0); } // read them back, update them, save them again, var savedDeps = depts.All(where : "WHERE DEPTNO=:0 OR DEPTNO=:1", args: new object[] { ((dynamic)toSave[0]).DEPTNO, ((dynamic)toSave[1]).DEPTNO }).ToList(); Assert.AreEqual(2, savedDeps.Count); savedDeps[0].LOC += "C"; savedDeps[1].LOC += "C"; result = depts.Save(toSave); Assert.AreEqual(2, result); Assert.AreEqual(1, depts.Delete(savedDeps[0].DEPTNO)); Assert.AreEqual(1, depts.Delete(savedDeps[1].DEPTNO)); }
public void NormalWhereCall() { // Check that things are up and running normally before trying the new stuff var db = new Department(ProviderName); var rows = db.All(where : "LOC = :0", args: "Nowhere"); Assert.AreEqual(9, rows.ToList().Count); }
public void All_NoParameters() { var depts = new Department(ProviderName); var allRows = depts.All().ToList(); Assert.AreEqual(60, allRows.Count); foreach (var d in allRows) { Console.WriteLine("{0} {1} {2}", d.DEPTNO, d.DNAME, d.LOC); } }
public void All_WhereSpecification_OrderBySpecification_LimitSpecification() { var depts = new Department(ProviderName); var allRows = depts.All(limit: 6, orderBy: "DEPTNO DESC", where : "WHERE LOC=:0", args: "Nowhere").ToList(); Assert.AreEqual(6, allRows.Count); int previous = int.MaxValue; foreach (var r in allRows) { int current = r.DEPTNO; Assert.IsTrue(current <= previous); previous = current; } }