Exemplo n.º 1
0
 public void TestCreateTableTestClass4()
 {
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.CreateTable<TestClass4>();
 }
Exemplo n.º 2
0
 public void TestCreateTableWithoutDef()
 {
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.CreateTable<TestClass2>();
 }
Exemplo n.º 3
0
 private void GenTestClass3TestData()
 {
     TestCreateTableTestClass3();
     var c1 = new TestClass3();
     c1.ID = "5555";
     c1.NAME = "N5555";
     var c2 = new TestClass3();
     c2.ID = "5566";
     c2.NAME = "N5555";
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.Insert<TestClass3>(c1);
     sqliteDbc.Insert<TestClass3>(c2);
 }
Exemplo n.º 4
0
 private void GenTestClass4TestData()
 {
     TestCreateTableTestClass4();
     var c1 = new TestClass4();
     c1.ID = "5555";
     c1.Age = 13;
     var c2 = new TestClass4();
     c2.ID = "5566";
     c2.Age = 12;
     var c3 = new TestClass4();
     c3.ID = "1234";
     c3.Age = 15;
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.Insert<TestClass4>(c1);
     sqliteDbc.Insert<TestClass4>(c2);
     sqliteDbc.Insert<TestClass4>(c3);
 }
Exemplo n.º 5
0
 public void TestSelectClass3SelectByName()
 {
     GenTestClass3TestData();
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     var result = sqliteDbc.FilterBy(FilterType.EQUAL_AND, new { NAME = "N5555" })
                           .Query<TestClass3>();
     Assert.AreEqual(result.Count(), 2);
 }
Exemplo n.º 6
0
        public void TestSelectClass4SelectByAge()
        {
            GenTestClass4TestData();
            var sqliteDbc = new NLORMSQLiteDb(connectionString);
            var result = sqliteDbc.FilterBy(FilterType.LESS_AND, new { Age = 14})
                                  .Query<TestClass4>();

            Assert.AreEqual(result.Count(), 2);
        }
Exemplo n.º 7
0
 public void TestSelectClass1WithCons()
 {
     TestCreateTable();
     var c1 = new TestClass();
     c1.ID = "5555";
     var c2 = new TestClass();
     c2.ID = "5566";
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.Insert<TestClass>(c1);
     sqliteDbc.Insert<TestClass>(c2);
     var result = sqliteDbc.FilterBy(FilterType.EQUAL_AND, new { ID = "5555" })
                           .Query<TestClass>();
     Assert.AreEqual(result.Count(), 1);
 }
Exemplo n.º 8
0
 public void TestSelectClass1()
 {
     TestCreateTable();
     var c1 = new TestClass();
     c1.ID = "5555";
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.Insert<TestClass>(c1);
     var result = sqliteDbc.Query<TestClass>();
     Assert.AreEqual(result.Count(), 1);
 }
Exemplo n.º 9
0
 public void TestInsertClassMutiData()
 {
     TestCreateTable();
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     for (int i = 0; i < 600; i++)
     {
         var c1 = new TestClass();
         c1.ID = "id"+i.ToString();
         sqliteDbc.Insert<TestClass>(c1);
     }
     var result = sqliteDbc.Query<TestClass>("SELECT * FROM  TestClass");
     Assert.AreEqual(result.Count(), 600);
 }
Exemplo n.º 10
0
        public void TestInsertClass2()
        {
            TestCreateTableWithoutDef();
            var c1 = new TestClass2();
            c1.ID = "5555";
            var sqliteDbc = new NLORMSQLiteDb(connectionString);
            sqliteDbc.Insert<TestClass2>(c1);
            var d1 = new { a1 = 1 };

            var result = sqliteDbc.Query<TestClass2>("SELECT * FROM  TestClass2");
            Assert.AreEqual(result.Count(), 1);
        }
Exemplo n.º 11
0
 public void TestDropTableTestClass3()
 {
     TestCreateTableTestClass3();
     var sqliteDbc = new NLORMSQLiteDb(connectionString);
     sqliteDbc.DropTable<TestClass3>();
 }