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

            adapter.ComplexProp.Description = "Something Different";
            Assert.Equal("Something Different", adapter.ComplexProp.Description);
            Assert.True(adapter.ComplexProp.IsChanged);
            Assert.True(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.Equal("Like address", adapter.ComplexProp.Description);
            Assert.False(adapter.ComplexProp.IsChanged);
            Assert.False(adapter.IsChanged);
        }
示例#2
0
        public void ShouldRejectChanges()
        {
            Initialize();
            var adapter = new PocoTestAdapter(_tester);

            var listItemToModify = adapter.Items.First();

            listItemToModify.Description = "modified item";

            Assert.True(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.False(adapter.IsChanged);
            Assert.Equal("Description01", listItemToModify.Description);
            Assert.Equal("Description01", listItemToModify.DescriptionOriginal);
        }
示例#3
0
        public void ShouldRejectChanges()
        {
            Initialize();
            var adapter = new PocoTestAdapter(_tester);

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

            adapter.RejectChanges();

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