Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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());
 }
Exemplo n.º 5
0
        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());
        }
Exemplo n.º 6
0
        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());
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 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());
 }
Exemplo n.º 11
0
        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);
        }