public void TestDeleteAllRecords() { var db = new NLORMMSSQLDb(connectionString); int totalcount = db.Query<TestClassOne>().Count(); int dc = db.Delete<TestClassOne>(); var items = db.Query<TestClassOne>(); Assert.AreEqual(dc, totalcount); }
public void TestDeleteAllRecords() { var db = new NLORMMSSQLDb(connectionString); insertdata(db); int totalcount = db.Query <TestClassOne>().Count(); int dc = db.Delete <TestClassOne>(); var items = db.Query <TestClassOne>(); Assert.AreEqual(dc, totalcount); }
public void TestInsertUserClassMuti() { var db = new NLORMMSSQLDb(ConnectionString); db.CreateTable <TestClassUser>(); var insertList = new List <TestClassUser>(); for (int i = 0; i < 30; i++) { var testObj = new TestClassUser { ID = i, Name = "Name " + i, CreateTime = DateTime.Now.AddDays(i) }; insertList.Add(testObj); } foreach (TestClassUser user in insertList) { db.Insert <TestClassUser>(user); } var selLis = db.Query <TestClassUser>(); Assert.AreEqual(selLis.Count(), 30); }
public void TestDeleteTwoRecord() { var db = new NLORMMSSQLDb(connectionString); db.FilterBy(FilterType.EQUAL_AND, new { income = 901234 }).Delete<TestClassOne>(); var items = db.Query<TestClassOne>(); Assert.AreEqual(3, items.Count()); }
public void TestDeleteTwoRecord() { var db = new NLORMMSSQLDb(connectionString); insertdata(db); db.FilterBy(FilterType.EQUAL_AND, new { income = 901234 }).Delete <TestClassOne>(); var items = db.Query <TestClassOne>(); Assert.AreEqual(3, items.Count()); }
public void TestQueryMethod1() { INLORMDb db = null; db = new NLORMMSSQLDb(ConnectionString); this.TestInsertAlotItems(); var result = db.Query <TestClass01>(@"SELECT * FROM TestClass01 where ID = @ID", new TestClass01() { ID = @"01" }); Assert.AreEqual(1, result.Count()); }
public void TestInsertAlotItems() { INLORMDb db = new NLORMMSSQLDb(ConnectionString); db.CreateTable <TestClass01>(); for (int i = 0; i < 1000; i++) { db.Insert <TestClass01>(new TestClass01() { ID = @"0" + i.ToString(), name = @"00" + i.ToString() }); } var result = db.Query <TestClass01>(@"SELECT * FROM TestClass01"); Assert.AreEqual(result.Count(), 1000); }
public void TestTransactionCommit() { var db = new NLORMMSSQLDb(ConnectionString); db.CreateTable <TestClassUser>(); var trans = db.BeginTransaction(); var testObj = new TestClassUser(); testObj.ID = 1; testObj.Name = "Name " + 1; testObj.CreateTime = DateTime.Now; db.Insert <TestClassUser>(testObj); trans.Commit(); db.Close(); db = new NLORMMSSQLDb(ConnectionString); var selLis = db.Query <TestClassUser>(); Assert.AreEqual(selLis.Count(), 1); }
public void TestInsertUserClass() { var db = new NLORMMSSQLDb(ConnectionString); db.CreateTable <TestClassUser>(); var testObj = new TestClassUser(); testObj.ID = 1; testObj.Name = "Name " + 1; testObj.CreateTime = DateTime.Now; db.Insert <TestClassUser>(testObj); var selLis = db.Query <TestClassUser>(); Assert.AreEqual(selLis.Count(), 1); var selUser = selLis.ToArray()[0]; Assert.AreEqual(testObj.ID, selUser.ID); Assert.AreEqual(testObj.Name, selUser.Name); //Assert.AreEqual(testObj.CreateTime,selUser.CreateTime); }
public void TestQueryMethod1() { INLORMDb db = null; db = new NLORMMSSQLDb( constr); this.TestInsertAlotItems(); var result = db.Query<TestClass01>( @"SELECT * FROM TestClass01 where ID = @ID", new TestClass01(){ ID = @"01"}); Assert.AreEqual( 1, result.Count()); }
public void TestInsertAlotItems() { INLORMDb db = new NLORMMSSQLDb( constr); db.CreateTable<TestClass01>(); for ( int i = 0; i < 1000; i++) { db.Insert<TestClass01>( new TestClass01(){ ID = @"0" + i.ToString(), name = @"00" + i.ToString() }); } var result = db.Query<TestClass01>(@"SELECT * FROM TestClass01"); Assert.AreEqual( result.Count(), 1000); }