public void Manually_Updating_The_Field_Value_Should_Update_The_Graph_And_Fire_Change_Event()
        {
            //cache the old address, then replace
            var oldAddress = Student.School.Address;
            var newAddress = TestUtil.CreateAddress("Paris");

            Student.School.Address = newAddress;

            //still has the old instance?
            Assert.AreEqual(oldAddress.City, Dependency.LeafValue);
            Assert.AreNotSame(newAddress, Dependency.LeafNode.ParentNode.NodeValue);
            Assert.AreSame(oldAddress, Dependency.LeafNode.ParentNode.NodeValue);
            Assert.AreEqual(0, ChangeEventCount);

            //update the node value manually
            Dependency.LeafNode.ParentNode.SetNodeValue(newAddress, true);

            //update should have been performed, and the event should have fired
            Assert.AreEqual("Paris", Dependency.LeafValue);
            Assert.AreSame(newAddress, Dependency.LeafNode.ParentNode.NodeValue);
            Assert.AreSame(newAddress, Student.School.Address);
            Assert.AreEqual(1, ChangeEventCount);
            Assert.AreEqual("Paris", LastEventArgs.TryGetLeafValue(""));
            //the announced member name should return the field name
            Assert.AreEqual("address", LastEventArgs.ChangedMemberName);
            //we exchanged a member in the graph
            Assert.AreEqual(DependencyChangeSource.DependencyGraphChange, LastEventArgs.Reason);
        }
        public void Change_On_The_Fields_Parent_Should_Update_The_Graph_Including_The_Field()
        {
            var school = TestUtil.CreateTestStudent("Harvard").School;

            Student.School = school;

            Assert.AreEqual(1, ChangeEventCount);
            Assert.AreEqual(DependencyChangeSource.DependencyGraphChange, LastEventArgs.Reason);

            //changed reference for field and field's City property?
            Assert.AreSame(school.Address, Dependency.LeafNode.ParentNode.NodeValue);
            Assert.AreEqual("Harvard", Dependency.LeafValue);

            //update dependency target
            school.Address.City = "New York";
            Assert.AreEqual(2, ChangeEventCount);
            Assert.AreEqual("New York", Dependency.LeafValue);
            Assert.AreEqual("New York", LastEventArgs.TryGetLeafValue(""));
        }