示例#1
0
        public void Should_Reject_Changes_For_Complex_Properties()
        {
            var adapter = new PocoTestAdapter(_tester);

            adapter.ComplexProp.Description = "Something Different";
            Assert.AreEqual("Something Different", adapter.ComplexProp.Description);
            Assert.IsTrue(adapter.ComplexProp.IsChanged);
            Assert.IsTrue(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.AreEqual("Like address", adapter.ComplexProp.Description);
            Assert.IsFalse(adapter.ComplexProp.IsChanged);
            Assert.IsFalse(adapter.IsChanged);
        }
示例#2
0
        public void Should_Reject_Changes_When_Called_On_Adapter()
        {
            var adapter = new PocoTestAdapter(_tester);

            var listItemToModify = adapter.Items.First();

            listItemToModify.Description = "modified item";

            Assert.IsTrue(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.IsFalse(adapter.IsChanged);
            Assert.AreEqual("Description01", listItemToModify.Description);
            Assert.AreEqual("Description01", listItemToModify.DescriptionOriginal);
        }
示例#3
0
        public void Should_Reject_Changes()
        {
            var adapter = new PocoTestAdapter(_tester);

            adapter.TestName = "Sandra";
            adapter.TestId   = 100;
            Assert.AreEqual("Sandra", adapter.TestName);
            Assert.AreEqual("Roger", adapter.TestNameOriginal);
            Assert.IsTrue(adapter.TestIdHasChanged);
            Assert.IsTrue(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.AreEqual("Roger", adapter.TestName);
            Assert.AreEqual("Roger", adapter.TestNameOriginal);
            Assert.AreEqual(25, adapter.TestId);
            Assert.IsFalse(adapter.TestIdHasChanged);
            Assert.IsFalse(adapter.IsChanged);
        }