public void FireEventEvenNewIsSameAsOldValue() { var o = new NotifiableTestClass(); var observable = Post.Cast <NotifiableTestClass, INotifyPropertyChanged>(o); var count = 0; observable.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { Assert.AreEqual("Name", e.PropertyName); count++; }; o.Name = "Onno"; //event should fire o.Name = "Onno"; Assert.AreEqual(2, count); }
public void TestChangingPrivateProperty() { NotifiableTestClass notifiableTestClass = new NotifiableTestClass(); int changeCount = 0; Post.Cast <NotifiableTestClass, INotifyPropertyChanged>(notifiableTestClass).PropertyChanged += delegate(object sender, System.ComponentModel.PropertyChangedEventArgs e) { Assert.AreEqual("Name", e.PropertyName); changeCount++; }; notifiableTestClass.SetNameUsingPrivateMethod("My New Name"); Assert.AreEqual("My New Name", notifiableTestClass.Name); Assert.AreEqual(1, changeCount); }