public void CanSaveNullableEnum_with_specific_id_select_with_type() { using (var db = OpenDbConnection()) { db.DropAndCreateTable <MyObj>(); var exists = db.SingleById <MyObj>(1); if (exists != null) { db.DeleteById <MyObj>(1); } } using (var con = OpenDbConnection()) { var myObj = new MyObj(); myObj.Id = 1; myObj.Test = MyEnum.One; con.Insert(myObj); myObj = con.Single <MyObj>(x => x.Id == 1); Assert.That(myObj.Id, Is.EqualTo(1)); Assert.That(myObj.Test, Is.Not.EqualTo(null)); Assert.That(myObj.Test, Is.EqualTo(MyEnum.One)); } }
public void CanSaveNullableEnum_with_specific_id_select_with_anon_type() { using (var db = OpenDbConnection()) { db.DropAndCreateTable <MyObj>(); var myObj = new MyObj(); myObj.Id = 1; myObj.Test = MyEnum.One; db.Insert(myObj); myObj = db.Single <MyObj>(new { Id = 1 }); Assert.That(myObj.Id, Is.EqualTo(1)); Assert.That(myObj.Test, Is.Not.EqualTo(null)); Assert.That(myObj.Test, Is.EqualTo(MyEnum.One)); } }
public void CanSaveNullableEnum_with_specific_id_select_with_type() { using (var db = OpenDbConnection()) { db.DropAndCreateTable<MyObj>(); var exists = db.SingleById<MyObj>(1); if (exists != null) { db.DeleteById<MyObj>(1); } } using (var con = OpenDbConnection()) { var myObj = new MyObj(); myObj.Id = 1; myObj.Test = MyEnum.One; con.Insert(myObj); myObj = con.Single<MyObj>(x => x.Id == 1); Assert.That(myObj.Id, Is.EqualTo(1)); Assert.That(myObj.Test, Is.Not.EqualTo(null)); Assert.That(myObj.Test, Is.EqualTo(MyEnum.One)); } }
public void CanSaveNullableEnum_with_specific_id_select_with_anon_type() { using (var db = OpenDbConnection()) { db.DropAndCreateTable<MyObj>(); var myObj = new MyObj(); myObj.Id = 1; myObj.Test = MyEnum.One; db.Insert(myObj); myObj = db.Single<MyObj>(new {Id = 1}); Assert.That(myObj.Id, Is.EqualTo(1)); Assert.That(myObj.Test, Is.Not.EqualTo(null)); Assert.That(myObj.Test, Is.EqualTo(MyEnum.One)); } }