예제 #1
0
        public void ShouldAcceptChanges()
        {
            var wrapper = new PersonWrapper(_person);

            wrapper.Address.StreetName = "XYZ";
            Assert.AreEqual("ChemCentre, Perth", wrapper.Address.StreetNameOriginalValue);

            wrapper.AcceptChanges();

            Assert.IsFalse(wrapper.IsChanged);
            Assert.AreEqual("XYZ", wrapper.Address.StreetName);
            Assert.AreEqual("XYZ", wrapper.Address.StreetNameOriginalValue);
        }
        public void ShouldAcceptChanges()
        {
            var wrapper = new PersonWrapper(_person);

            var emailToModify = wrapper.Emails.First();

            emailToModify.EmailAddress = "*****@*****.**";

            Assert.IsTrue(wrapper.IsChanged);

            wrapper.AcceptChanges();

            Assert.IsFalse(wrapper.IsChanged);
            Assert.AreEqual("*****@*****.**", emailToModify.EmailAddress);
            Assert.AreEqual("*****@*****.**", emailToModify.EmailAddressOriginalValue);
        }
예제 #3
0
        public void ShouldAcceptChanges()
        {
            var wrapper = new PersonWrapper(_person);

            wrapper.Name = "Nik";

            Assert.AreEqual("Nik", wrapper.Name);
            Assert.AreEqual("Tarique Memon", wrapper.NameOriginalValue);
            Assert.IsTrue(wrapper.NameIsChanged);
            Assert.IsTrue(wrapper.IsChanged);

            wrapper.AcceptChanges();

            Assert.AreEqual("Nik", wrapper.Name);
            Assert.AreEqual("Nik", wrapper.NameOriginalValue);
            Assert.IsFalse(wrapper.NameIsChanged);
            Assert.IsFalse(wrapper.IsChanged);
        }