public void TestPropertyChangedException() { var x = new NotifyPropertyChangedMock(); x.PropertyChanged += (sender, args) => { throw new Exception("TEST"); }; Assert.Throws <AggregateException>(() => { x.IntPropertyA = 88; }); }
public void TestPropertyChangedNoChange() { var x = new NotifyPropertyChangedMock(); x.IntPropertyA = 88; PropertyChangedEventArgs eventArgs = null; x.PropertyChanged += (sender, args) => { eventArgs = args; }; x.IntPropertyA = 88; Assert.Null(eventArgs); }
public void TestPropertyChangedSuspended() { var x = new NotifyPropertyChangedMock(); PropertyChangedEventArgs eventArgs = null; x.PropertyChanged += (sender, args) => { eventArgs = args; }; x.DisablePropertyChangedEvents(); x.IntPropertyA = 99; x.EnablePropertyChangedEvents(); Assert.Null(eventArgs); //TODO: Validate that this is per-thread. }
public void TestPropertyChanged() { var x = new NotifyPropertyChangedMock(); PropertyChangedEventArgs eventArgs = null; x.PropertyChanged += (sender, args) => { eventArgs = args; }; x.IntPropertyA = 88; Assert.NotNull(eventArgs); Assert.Equal(nameof(NotifyPropertyChangedMock.IntPropertyA), eventArgs.PropertyName); Assert.True(x.LastPropertyAssignmentWasChange); eventArgs = null; x.IntPropertyA = 88; Assert.Null(eventArgs); Assert.False(x.LastPropertyAssignmentWasChange); }