public void TestGetList() { var list = TestExten.GetList("name is not null"); Assert.IsNotNull(list); Assert.IsTrue(list.Count > 0); }
public void TestDeleteListByPrimaryArray() { var list = TestExten.GetList("1=1").Take(2).ToList(); var row = TestExten.Delete(list.Select(m => m.id).ToArray()); Assert.AreEqual(list.Count, row); }
public void TestDeleteList() { var list = TestExten.GetList("1=1").Take(3).ToList(); var row = list.Delete(); Assert.AreEqual(list.Count, row); }
public void TestUpdateList() { var list = TestExten.GetList("1=1").Take(3).ToList(); for (var i = 0; i < list.Count; i++) { list[i].Time = DateTime.Now; } var row = list.Update(); Assert.AreEqual(list.Count, row); }
public void TestPageList() { var index = 2; var size = 3; var list = TestExten.GetPageList(index, size); var tarlist = TestExten.GetList("1=1").OrderByDescending(m => m.id).Skip((index - 1) * size).Take(size).ToList(); bool valid = true; var actual = list.Data as List <Entity.dapper_test.Test>; for (var i = 0; i < actual.Count; i++) { if (!tarlist[i].id.Equals(actual[i].id)) { valid = false; } } Assert.IsTrue(valid); }