public void ValidatesParentOnPropertyChanged() { var c = new ValidatableChild(); var p = new ValidatableParent(); p.Child = c; Assert.IsFalse(p.HasErrors); Assert.IsFalse(c.HasErrors); c.Name = string.Empty; Assert.IsTrue(p.HasErrors); Assert.IsTrue(c.HasErrors); c.Name = "Funny"; Assert.IsFalse(p.HasErrors); Assert.IsFalse(c.HasErrors); }
public void ValidatesParentOnCollectionItemPropertyChanged() { var c = new ValidatableChild(); var p = new ValidatableParent(); p.Collection = new ObservableCollection <ValidatableChild>(); p.Collection.Add(c); Assert.IsFalse(p.HasErrors); Assert.IsFalse(c.HasErrors); c.Name = string.Empty; Assert.IsTrue(p.HasErrors); Assert.IsTrue(c.HasErrors); c.Name = "Bunny"; Assert.IsFalse(p.HasErrors); Assert.IsFalse(c.HasErrors); }