示例#1
0
        public void ReadWrite_IntsIntoEnums()
        {
            var db        = new EnumTests();
            var intValues = new { ByteField = 4, ShortField = 7, IntField = 10 };
            var item      = db.Insert(intValues);
            var reloaded  = db.Single("EnumTestID = @0", item.ID);

            Assert.That((int)reloaded.ByteField, Is.EqualTo(intValues.ByteField));
            Assert.That((int)reloaded.ShortField, Is.EqualTo(intValues.ShortField));
            Assert.That((int)reloaded.IntField, Is.EqualTo(intValues.IntField));
        }
示例#2
0
        public void ReadWrite_Enum()
        {
            var db     = new EnumTests();
            var values = new {
                ByteField  = EnumTest.MyByteEnum.value_3,
                ShortField = EnumTest.MyShortEnum.value_6,
                IntField   = EnumTest.MyIntEnum.value_9
            };
            var item = db.New(values);

            Assert.That(item.ID, Is.EqualTo(0));
            Assert.That((int)item.ByteField, Is.EqualTo(3));
            Assert.That((int)item.ShortField, Is.EqualTo(6));
            Assert.That((int)item.IntField, Is.EqualTo(9));
            db.Save(item);
            Assert.That(item.ID, Is.Not.EqualTo(0));
            var reloaded = db.Single("EnumTestID = @0", item.ID);

            Assert.That(reloaded.ByteField, Is.EqualTo(item.ByteField));
            Assert.That(reloaded.ShortField, Is.EqualTo(item.ShortField));
            Assert.That(reloaded.IntField, Is.EqualTo(item.IntField));
        }