public void When_PropertyChanged_Suppressed_Then_NotifyPropertyChanged_Does_Not_Fire_PropertyChanged() { // Arrange var eventCount = 0; var sut = new PropertyChangeHelper(this); sut.PropertyChanged += (sender, args) => ++eventCount; // Act using (sut.SuppressPropertyChanged()) sut.NotifyPropertyChanged("Age", "UserData-1"); // Assert Assert.AreEqual(0, eventCount); }
public void When_NotifyPropertyValueChanged_Then_Fires_PropertyChange_On_Event_With_Correct_Values() { // Arrange var propertyChanges = new List<PropertyChangedEventArgsEx>(); var sut = new PropertyChangeHelper(this); sut.PropertyChanged += (sender, args) => propertyChanges.Add((PropertyChangedEventArgsEx) args); var expectedPropertyChange = new PropertyChangedEventArgsEx("Age", "UserData-2"); // Act sut.NotifyPropertyChanged("Age", "UserData-2"); // Assert Assert.AreEqual(1, propertyChanges.Count); Assert.AreEqual(expectedPropertyChange, propertyChanges[0]); }