public void RaisePropertyChangedWhenPropertyValueChanges() { // Arrange BindableTestClass testClass = new BindableTestClass(); testClass.MonitorEvents <INotifyPropertyChanged>(); // Act testClass.Title = "Hello"; testClass.Number = 10; testClass.Name = "Michael"; // Assert testClass.ShouldRaisePropertyChangeFor(x => x.Title); testClass.ShouldRaisePropertyChangeFor(x => x.Number); testClass.ShouldRaisePropertyChangeFor(x => x.Name); }
public void DoNotRaisePropertyChangedWhenPropertyValuesGetSameValue() { // Arrange const string expectedTitle = "new Title"; const int expectedNumber = 32; const string expectedName = "Andre"; BindableTestClass testClass = new BindableTestClass(expectedTitle, expectedNumber, expectedName); testClass.MonitorEvents <INotifyPropertyChanged>(); // Act testClass.Title = expectedTitle; testClass.Number = expectedNumber; testClass.Name = expectedName; // Assert testClass.ShouldNotRaisePropertyChangeFor(x => x.Title); testClass.ShouldNotRaisePropertyChangeFor(x => x.Number); testClass.ShouldNotRaisePropertyChangeFor(x => x.Name); }