示例#1
0
 public void TestUpdateOneRow()
 {
     var db = new NLORMMSSQLDb(connectionString);
     var newobj = new TestClassOne { Id = "sssss", income = 100 };
     int i = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Update<TestClassOne>(newobj);
     var items = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Query<TestClassOne>().First();
     Assert.AreEqual(100, items.income);
 }
示例#2
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());
 }
示例#3
0
        public void TestDeleteOneRecord()
        {
            var db = new NLORMMSSQLDb(connectionString);

            insertdata(db);
            int deletedcount = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Delete <TestClassOne>();

            Assert.AreEqual(deletedcount, 1);
        }
示例#4
0
        public void TestUpdateOneRow()
        {
            var db     = new NLORMMSSQLDb(connectionString);
            var oldobj = new TestClassOne()
            {
                Id = "sssss", income = 20
            };
            var newobj = new TestClassOne {
                Id = "sssss", income = 100
            };

            db.CreateTable <TestClassOne>();
            db.Insert <TestClassOne>(oldobj);
            int i     = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Update <TestClassOne>(newobj);
            var items = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Query <TestClassOne>().First();

            Assert.AreEqual(100, items.income);
        }
示例#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());
        }
示例#6
0
        public void TestQueryMethod2()
        {
            INLORMDb db = new NLORMMSSQLDb(ConnectionString);

            db.CreateTable <TestClass01>();
            db.Insert <TestClass01>(new TestClass01()
            {
                ID = @"11", name = @"albert"
            });
            db.Insert <TestClass01>(new TestClass01()
            {
                ID = @"22", name = @"star"
            });
            var result = db.FilterBy(FilterType.EQUAL_AND, new { name = "albert" }).Query <TestClass01>();

            Assert.AreEqual(1, result.Count());
        }
示例#7
0
        public void TestQueryMethod2()
        {
            INLORMDb db = new NLORMMSSQLDb( constr);
            db.CreateTable<TestClass01>();
            db.Insert<TestClass01>( new TestClass01(){ ID = @"11", name = @"albert"});
            db.Insert<TestClass01>( new TestClass01(){ ID = @"22", name = @"star"});
            var result = db.FilterBy( FilterType.EQUAL_AND, new { name = "albert"} ).Query<TestClass01>();

            Assert.AreEqual( 1, result.Count() );
        }
示例#8
0
 public void TestDeleteOneRecord()
 {
     var db = new NLORMMSSQLDb(connectionString);
     int deletedcount = db.FilterBy(FilterType.EQUAL_AND, new { Id = "sssss" }).Delete<TestClassOne>();
     Assert.AreEqual(deletedcount, 1);
 }