public void CreateInsertDrop()
        {
            var db = new OrmTestSession();

            db.CreateTable <Product>();

            db.Insert(new Product
            {
                Name  = "Hello",
                Price = 16,
            });

            int n = db.Table <Product>().Count();

            Assert.AreEqual(1, n);

            db.DropTable <Product>();

            try
            {
                // Should throw SqliteException
                db.Table <Product>().Count();

                Assert.Fail("Expeced 'table does not exist' error.");
            }
            catch (SqliteException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }
        public void CreateInsertDrop()
        {
            var db = new OrmTestSession();

            db.CreateTable<Product>();

            db.Insert(new Product
                          {
                              Name = "Hello",
                              Price = 16,
                          });

            int n = db.Table<Product>().Count();

            Assert.AreEqual(1, n);

            db.DropTable<Product>();

            try
            {
                // Should throw SqliteException
                db.Table<Product>().Count();

                Assert.Fail("Expeced 'table does not exist' error.");
            }
            catch (SqliteException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }
        public void CreateInsertDrop()
        {
            var db = new OrmTestSession();

            db.CreateTable<Product>();

            db.Insert(new Product { Name = "Hello", Price = 16, });

            int n = db.Table<Product>().Count();

            Assert.AreEqual(1, n);

            db.DropTable<Product>();

            ExceptionAssert.Throws<SqliteException>(() => db.Table<Product>().Count());
        }
Example #4
0
        public void CreateInsertDrop()
        {
            var db = new OrmTestSession();

            db.CreateTable <Product>();

            db.Insert(new Product {
                Name = "Hello", Price = 16,
            });

            int n = db.Table <Product>().Count();

            Assert.AreEqual(1, n);

            db.DropTable <Product>();

            ExceptionAssert.Throws <SqliteException>(() => db.Table <Product>().Count());
        }