Пример #1
0
        public void TestCrud()
        {
            var o = new NullableTable {
                Name = null, MyInt = null, MyBool = null
            };

            o.Save();

            NullableTable o1 = NullableTable.FindById(o.Id);

            Assert.AreEqual(null, o1.Name);
            Assert.IsTrue(null == o1.MyInt);
            Assert.IsTrue(null == o1.MyBool);

            o1.Name  = "jerry";
            o1.MyInt = 11;
            o1.Save();

            NullableTable o2 = NullableTable.FindById(o.Id);

            Assert.AreEqual("jerry", o2.Name);
            Assert.IsTrue(11 == o2.MyInt);
            Assert.IsTrue(null == o2.MyBool);

            o2.MyInt  = 18;
            o2.MyBool = true;
            o2.Save();

            NullableTable o3 = NullableTable.FindById(o.Id);

            Assert.AreEqual("jerry", o3.Name);
            Assert.IsTrue(18 == o3.MyInt);
            Assert.IsTrue(true == o3.MyBool);

            o3.Name   = null;
            o3.MyInt  = null;
            o3.MyBool = null;
            o3.Save();

            NullableTable o4 = NullableTable.FindById(o.Id);

            Assert.AreEqual(null, o4.Name);
            Assert.IsTrue(null == o4.MyInt);
            Assert.IsTrue(null == o4.MyBool);

            o4.Delete();

            NullableTable o5 = NullableTable.FindById(o.Id);

            Assert.IsNull(o5);
        }
Пример #2
0
        public void TestEmptyString()
        {
            var o = new NullableTable {
                Name = ""
            };

            o.Save();

            var o1 = NullableTable.FindById(o.Id);

            Assert.IsNotNull(o1);
            Assert.IsNotNull(o1.Name);
            Assert.AreEqual("", o1.Name);
        }