Esempio n. 1
0
        public void Can_Persist_Nullable_Enum_To_Text_Column()
        {
            var db = SqlServerNorthwindDatabase();

            using (var tx = db.EnsureInTransaction()) {
                var table = db.Table <Enum.NullableToTextColumn.Category>();

                var item = new Enum.NullableToTextColumn.Category {
                    CategoryName = Enum.CategoryEnum.Foo
                };

                table.Add(item);

                Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

                item.CategoryName = Enum.CategoryEnum.Bar;

                table.Update(item);

                Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

                tx.Rollback();
            }
        }
Esempio n. 2
0
        public void Can_Persist_Nullable_Enum_To_Text_Column()
        {
            var db = new Database(conn, new AttributeMappingSource().GetModel(typeof(Enum.NullableToTextColumn.Category)));

            using (var tx = db.EnsureInTransaction()) {
                var table = db.Table <Enum.NullableToTextColumn.Category>();

                var item = new Enum.NullableToTextColumn.Category {
                    CategoryName = Enum.CategoryEnum.Foo
                };

                table.Add(item);

                Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

                item.CategoryName = Enum.CategoryEnum.Bar;

                table.Update(item);

                Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

                tx.Rollback();
            }
        }
        public void Can_Persist_Nullable_Enum_To_Text_Column()
        {
            var db = new Database(conn, new AttributeMappingSource().GetModel(typeof(Enum.NullableToTextColumn.Category)));

             using (var tx = db.EnsureInTransaction()) {

            var table = db.Table<Enum.NullableToTextColumn.Category>();

            var item = new Enum.NullableToTextColumn.Category {
               CategoryName = Enum.CategoryEnum.Foo
            };

            table.Add(item);

            Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

            item.CategoryName = Enum.CategoryEnum.Bar;

            table.Update(item);

            Assert.AreEqual(1, table.Count("CategoryID = {0} AND CategoryName = {1}", item.CategoryID, item.CategoryName.ToString()));

            tx.Rollback();
             }
        }