public void AddItemsThenThrowIgnoredChangeNotifications() { int eventsReceived = 0; sut = new PropertyWatcherList <PropertyWatcherTestClass>(new[] { "Test", "Things" }); sut.ValueChanged += (s, e) => ++ eventsReceived; var item1 = new PropertyWatcherTestClass(); var item2 = new PropertyWatcherTestClass(); var item3 = new PropertyWatcherTestClass(); sut.Add(0, item1); sut.Add(1, item2); sut.Add(2, item3); item1.ThrowChangeNotification("Abc"); item2.ThrowChangeNotification("Abc"); item3.ThrowChangeNotification("Abc"); Assert.Equal(0, eventsReceived); }
public void AddAndThenResetWithNewItemsThenThrowChangeNotifications() { int eventsReceived = 0; sut = new PropertyWatcherList <PropertyWatcherTestClass>(new[] { "Test", "Things" }); sut.ValueChanged += (s, e) => ++ eventsReceived; var item1 = new PropertyWatcherTestClass(); var item2 = new PropertyWatcherTestClass(); var item3 = new PropertyWatcherTestClass(); sut.Add(0, item1); sut.Add(0, item2); sut.Reset(new[] { item3 }); item1.ThrowChangeNotification("Test"); item2.ThrowChangeNotification("Things"); item3.ThrowChangeNotification("Test"); Assert.Equal(1, eventsReceived); }