public void TestDelete() { var test = TestExten.GetModel("1=1", "id"); var row = test.Delete(); Assert.AreEqual(1, row); }
public void TestGetModelByPrimary() { var data = TestExten.GetModel("1=1", "id"); var test = TestExten.GetModel(data.id); Assert.IsNotNull(test); }
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 TestDeleteByPrimary() { var test = TestExten.GetModel("1=1", "id"); var row = TestExten.Delete(test.id); Assert.AreEqual(1, row); }
public void TestUpdate() { var test = TestExten.GetModel("1=1", "id"); test.Time = DateTime.Now; var row = test.Update(); Assert.AreEqual(1, 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); }
public void TestGetModel() { var test = TestExten.GetModel("1=1", "id desc"); Assert.IsNotNull(test); }