예제 #1
0
        public void TestRollback()
        {
            var customer = new CustomerTest {
                ID = 1, Name = "Test", Address = "London"
            };

            customer.AcceptChanges();
            customer.Name = "Modified";

            customer.RejectChanges();

            Assert.IsTrue(customer.Name == "Test");
        }
예제 #2
0
        public void TestGetChangedProperties()
        {
            var customer = new CustomerTest {
                ID = 1, Name = "Test", Address = "London"
            };

            customer.AcceptChanges();
            customer.Name = "Modified";

            var changes = customer.GetChangedProperties();

            Assert.IsTrue(changes.Count == 1);
            Assert.IsTrue(changes[0] == nameof(customer.Name));
        }
예제 #3
0
        public void TestGetOldValue()
        {
            var customer = new CustomerTest {
                ID = 1, Name = "Test", Address = "London"
            };

            customer.AcceptChanges();
            customer.Name = "Modified";

            var old = customer.GetOldValue(x => x.Name);

            Assert.IsTrue(old.ToString() == "Test");

            customer.AcceptChanges();
            old = customer.GetOldValue(x => x.Name);

            Assert.IsTrue(old.ToString() == "Modified");
        }