public void EventBubblingChildObjectInAList() { //same situation but now with a child in a list ParentObject parent = new ParentObject(); int changeCount = 0; //add the child in a list ChildObject child = new ChildObject(); parent.Children.Add(child); Post.Cast<ParentObject, INotifyPropertyChanged>(parent).PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { Assert.AreEqual("Name", e.PropertyName); changeCount++; }; child.Name = "newName"; Assert.AreEqual(1, changeCount); }
public void SkipNotificationForSelectedProperty() { ParentObject parentObject = new ParentObject(); ChildObject childObject = new ChildObject(); parentObject.Child = childObject; int changeCount = 0; Post.Cast<ParentObject, INotifyPropertyChanged>(parentObject).PropertyChanged += delegate(object sender, System.ComponentModel.PropertyChangedEventArgs e) { Assert.AreEqual("Name", e.PropertyName); changeCount++; }; childObject.Parent = parentObject; Assert.AreEqual(0, changeCount); childObject.Name = "newName"; Assert.AreEqual(1, changeCount); }
public void EventBubblingChildObject() { ParentObject parent = new ParentObject(); int changeCount = 0; ChildObject child = new ChildObject(); parent.Child = child; Post.Cast<ParentObject, INotifyPropertyChanged>(parent).PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { Assert.AreEqual("Name", e.PropertyName); changeCount++; }; child.Name = "newName"; Assert.AreEqual(1, changeCount); }