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