Esempio n. 1
0
        public void DbRecordTest()
        {
            var target = new DbTest();

            Assert.IsFalse(target.IsNew);
            Assert.IsFalse(target.DeleteRecord);
            Assert.IsFalse(target.IsModified);
            Assert.IsFalse(target.NeedsSave);

            Assert.IsFalse(target.Fields["DbTestID"].IsSet);
            Assert.IsFalse(target.Fields["DbTestID"].IsModified);

            target.BeginInit();
            target.DbTestID = 0;
            target.EndInit();

            Assert.IsNotNull(target.Fields["DbTestID"].OriginalValue);
            Assert.AreEqual(0, target.Fields["DbTestID"].OriginalValue);
            Assert.IsTrue(target.Fields["DbTestID"].IsSet);
            Assert.IsFalse(target.Fields["DbTestID"].IsModified);

            target.DbTestID = 1;

            Assert.IsTrue(target.Fields["DbTestID"].IsModified);
        }
Esempio n. 2
0
        public void NonDbPropertyTest()
        {
            var target = new DbTest();

            Assert.IsFalse(target.Fields["NonDbProperty"].IsSet);
            target.NonDbProperty = 4;
            Assert.IsTrue(target.Fields["NonDbProperty"].IsSet);
            Assert.IsTrue(target.IsModified);
            Assert.IsFalse(target.NeedsSave);
        }
Esempio n. 3
0
        public void JoinTest()
        {
            // setup the repository for the joined object.
            var info = DbRecordInfo.GetRecordInfo(typeof(MyJoinedObject));

            info.Repository = new MockMyJoinedObjectRepository();

            var target = new DbTest();

            target.JoinID = int.MinValue;
            Assert.IsNull(target.Join);
            target.JoinID = 5;
            Assert.IsNotNull(target.Join);
            Assert.AreEqual(target.JoinID, target.Join.MyID);
            target.JoinID = 10;
            Assert.IsNotNull(target.Join);
            Assert.AreEqual(target.JoinID, target.Join.MyID);
        }
Esempio n. 4
0
 public void GetNonSetValueTest()
 {
     var target = new DbTest();
     var val    = target.DbTestID;
 }
Esempio n. 5
0
        public void GetNonInitOrigValExTest()
        {
            var target = new DbTest();

            Assert.IsNull(target.Fields["DbTestID"].OriginalValue);
        }