Exemple #1
0
        public void ShouldPersistAndReadEnum()
        {
            var db = new TestDb(TestPath.GetTempFileName());

            var obj1 = new TestObj()
            {
                Id = 1, Value = TestEnum.Value2
            };
            var obj2 = new TestObj()
            {
                Id = 2, Value = TestEnum.Value3
            };

            var numIn1 = db.Insert(obj1);
            var numIn2 = db.Insert(obj2);

            Assert.AreEqual(1, numIn1);
            Assert.AreEqual(1, numIn2);

            var result = db.Query <TestObj>("select * from TestObj").ToList();

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(obj1.Value, result[0].Value);
            Assert.AreEqual(obj2.Value, result[1].Value);

            Assert.AreEqual(obj1.Id, result[0].Id);
            Assert.AreEqual(obj2.Id, result[1].Id);

            db.Close();
        }
Exemple #2
0
        public void ShouldPersistAndReadGuid()
        {
            var db = new TestDb(TestPath.GetTempFileName());

            var obj1 = new TestObj()
            {
                Id = new Guid("36473164-C9E4-4CDF-B266-A0B287C85623"), Text = "First Guid Object"
            };
            var obj2 = new TestObj()
            {
                Id = new Guid("BC5C4C4A-CA57-4B61-8B53-9FD4673528B6"), Text = "Second Guid Object"
            };

            var numIn1 = db.Insert(obj1);
            var numIn2 = db.Insert(obj2);

            Assert.AreEqual(1, numIn1);
            Assert.AreEqual(1, numIn2);

            var result = db.Query <TestObj>("select * from TestObj").ToList();

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(obj1.Text, result[0].Text);
            Assert.AreEqual(obj2.Text, result[1].Text);

            Assert.AreEqual(obj1.Id, result[0].Id);
            Assert.AreEqual(obj2.Id, result[1].Id);

            db.Close();
        }
Exemple #3
0
 public void TearDown()
 {
     if (_db != null)
     {
         _db.Close();
     }
 }