public void Update_NoChangesMade_NoCollectionChangedRaised() { var collectionChangedEventArgsList = new List <NotifyCollectionChangedEventArgs>(); var collection = new ExtendedObservableCollection <int>(); collection.CollectionChanged += (_, args) => collectionChangedEventArgsList.Add(args); using (collection.Update()) { } Assert.Empty(collectionChangedEventArgsList); }
public void Update_ItemsAdded_CollectionChangedRaised() { var collectionChangedEventArgsList = new List <NotifyCollectionChangedEventArgs>(); var collection = new ExtendedObservableCollection <int>(); collection.CollectionChanged += (_, args) => collectionChangedEventArgsList.Add(args); using (collection.Update()) { collection.Add(123); collection.Add(456); } Assert.Equal(2, collection.Count); Assert.Single(collectionChangedEventArgsList); Assert.Equal(NotifyCollectionChangedAction.Reset, collectionChangedEventArgsList[0].Action); }