public void Remove_triggers_CollectionChanged() { var sut = new EventRaisingCollection <Person> (_source); NotifyCollectionChangedEventArgs capturedArgs = default; void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) => capturedArgs = args; sut.CollectionChanged += OnCollectionChanged; sut.Remove(SourceCollection.First()); sut.CollectionChanged -= OnCollectionChanged; Assert.That(capturedArgs, Is.Not.Null); }
public void Remove_triggers_both_remove_events() { // Arrange var sut = new EventRaisingCollection <Person> (_source); sut.BeforeRemove += RecordingCallbackOne; sut.AfterRemove += RecordingCallbackTwo; // Act sut.Remove(SourceCollection.First()); sut.BeforeRemove -= RecordingCallbackOne; sut.AfterRemove -= RecordingCallbackTwo; // Assert Assert.IsTrue(CallbackOneCalled, "Callback one"); Assert.IsTrue(CallbackTwoCalled, "Callback two"); }