示例#1
0
        public void ShouldAcceptChanges()
        {
            var wrapper = new FriendWrapper(_friend);

            wrapper.Address.City = "Salt Lake City";
            Assert.AreEqual("Mulheim", wrapper.Address.CityOriginalValue);

            wrapper.AcceptChanges();

            Assert.IsFalse(wrapper.IsChanged);
            Assert.AreEqual("Salt Lake City", wrapper.Address.City);
            Assert.AreEqual("Salt Lake City", wrapper.Address.CityOriginalValue);
        }
示例#2
0
        public void ShouldAcceptChanges()
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var wrapper = new FriendWrapper(_friend);

            wrapper.Address.City = "Salt Lake City";
            Assert.Equal("Müllheim", wrapper.Address.CityOriginalValue);

            wrapper.AcceptChanges();

            Assert.False(wrapper.IsChanged);
            Assert.Equal("Salt Lake City", wrapper.Address.City);
            Assert.Equal("Salt Lake City", wrapper.Address.CityOriginalValue);
        }
示例#3
0
        public void ShouldAcceptChanges()
        {
            var wrapper       = new FriendWrapper(_friend);
            var emailToModify = wrapper.Emails.First();

            emailToModify.Email = "*****@*****.**";
            Assert.AreEqual("*****@*****.**", emailToModify.EmailOriginalValue);
            Assert.IsTrue(wrapper.IsChanged);

            wrapper.AcceptChanges();

            Assert.IsFalse(wrapper.IsChanged);
            Assert.AreEqual("*****@*****.**", emailToModify.EmailOriginalValue);
            Assert.AreEqual("*****@*****.**", emailToModify.Email);
        }
示例#4
0
        public void ShouldAcceptChanges()
        {
            var wrapper = new FriendWrapper(_friend);

            wrapper.Address.City = "Vanadzor";
            Assert.AreEqual("Yerevan", wrapper.Address.CityOriginalValue);
            //Assert.IsTrue(wrapper.Address.CityIsChanged);
            //Assert.IsTrue(wrapper.Address.IsChanged);

            wrapper.AcceptChanges();

            Assert.AreEqual("Vanadzor", wrapper.Address.City);
            Assert.AreEqual("Vanadzor", wrapper.Address.CityOriginalValue); //After AcceptChanges() all save
            //Assert.IsFalse(wrapper.Address.CityIsChanged);
            //Assert.IsFalse(wrapper.Address.IsChanged);
        }
        public void ShouldAcceptChanges()
        {
            var wrapper = new FriendWrapper(_friend);

            wrapper.FirstName = "Yana";
            Assert.AreEqual("Yana", wrapper.FirstName);
            Assert.AreEqual("Levon", wrapper.FirstNameOriginalValue); // same in initialize()
            Assert.IsTrue(wrapper.FirstNameIsChanged);
            Assert.IsTrue(wrapper.IsChanged);

            wrapper.AcceptChanges();

            Assert.AreEqual("Yana", wrapper.FirstName);
            Assert.AreEqual("Yana", wrapper.FirstNameOriginalValue); //After AcceptChanges() all save
            Assert.IsFalse(wrapper.FirstNameIsChanged);
            Assert.IsFalse(wrapper.IsChanged);
        }
        public void ShouldAcceptChanges()
        {
            FriendWrapper wrapper = new FriendWrapper(_friend);

            wrapper.FirstName = "Julia";
            Assert.AreEqual("Julia", wrapper.FirstName);
            Assert.AreEqual("Thomas", wrapper.FirstNameOriginalValue);
            Assert.IsTrue(wrapper.FirstNameIsChanged);
            Assert.IsTrue(wrapper.IsChanged);

            wrapper.AcceptChanges();

            Assert.AreEqual("Julia", wrapper.FirstName);
            Assert.AreEqual("Julia", wrapper.FirstNameOriginalValue);
            Assert.IsFalse(wrapper.FirstNameIsChanged);
            Assert.IsFalse(wrapper.IsChanged);
        }