public void CanGetEnumValue()
 {
     using (var con = OpenDbConnection())
     {
         con.CreateTable<TypeWithEnum>(true);
         var obj = new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value1 };
         con.Save(obj);
         var target = con.SingleById<TypeWithEnum>(obj.Id);
         Assert.AreEqual(obj.Id, target.Id);
         Assert.AreEqual(obj.EnumValue, target.EnumValue);
     }
 }
Exemple #2
0
 public void CanGetEnumValue()
 {
     using (var con = ConnectionString.OpenDbConnection())
     {
         con.CreateTable <TypeWithEnum>(true);
         var obj = new TypeWithEnum {
             Id = 1, EnumValue = SomeEnum.Value1
         };
         con.Save(obj);
         var target = con.GetById <TypeWithEnum>(obj.Id);
         Assert.AreEqual(obj.Id, target.Id);
         Assert.AreEqual(obj.EnumValue, target.EnumValue);
     }
 }
        public void CanGetEnumValue()
        {
            using (var db = OpenDbConnection())
            {
                db.DropAndCreateTable <TypeWithEnum>();

                var obj = new TypeWithEnum {
                    Id = 1, EnumValue = SomeEnum.Value1
                };
                db.Save(obj);
                var target = db.SingleById <TypeWithEnum>(obj.Id);
                Assert.AreEqual(obj.Id, target.Id);
                Assert.AreEqual(obj.EnumValue, target.EnumValue);
            }
        }
Exemple #4
0
        public void Can_get_Scalar_Enum()
        {
            using var db = OpenDbConnection();
            db.DropAndCreateTable <TypeWithEnum>();

            var row = new TypeWithEnum {
                Id = 1, EnumValue = SomeEnum.Value2
            };

            db.Insert(row);

            var someEnum = db.Scalar <SomeEnum>(db.From <TypeWithEnum>()
                                                .Where(o => o.Id == row.Id)
                                                .Select(o => o.EnumValue));

            Assert.That(someEnum, Is.EqualTo(SomeEnum.Value2));
        }
        public void Can_get_Scalar_Enum()
        {
            using (var db = OpenDbConnection())
            {
                db.DropAndCreateTable<TypeWithEnum>();

                var row = new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value2 };
                db.Insert(row);

                var someEnum = db.Scalar<SomeEnum>(db.From<TypeWithEnum>()
                    .Where(o => o.Id == row.Id)
                    .Select(o => o.EnumValue));

                Assert.That(someEnum, Is.EqualTo(SomeEnum.Value2));
            }
        }