public void SkipCollectionChanged_RemoveRange_NoEventsRaised_Test() { int collectionChangedCounter = 0; NonNullObservableCollection <string> collection = new NonNullObservableCollection <string>(); collection.Add("1"); collection.Add("2"); collection.Add("3"); collection.CollectionChanged += (s, e) => collectionChangedCounter++; collection.RemoveRange(0, 0); Assert.Equal(0, collectionChangedCounter); }
public void SkipCollectionChanged_ReplaceRange_Empty_Test() { int collectionChangedCounter = 0; NonNullObservableCollection <string> collection = new NonNullObservableCollection <string>(); collection.Add("1"); collection.Add("2"); collection.Add("3"); collection.CollectionChanged += (s, e) => collectionChangedCounter++; collection.ReplaceRange(0, 0, new string[0]); Assert.Equal(0, collectionChangedCounter); collection.Add("1"); Assert.Equal(1, collectionChangedCounter); }
public void SkipCollectionChanged_AddRange_Test() { int collectionChangedCounter = 0; NonNullObservableCollection <string> collection = new NonNullObservableCollection <string>(); collection.Add("1"); collection.Add("2"); collection.Add("3"); collection.CollectionChanged += (s, e) => collectionChangedCounter++; Assert.Throws <ArgumentNullException>(() => collection.AddRange(new string[1])); Assert.Equal(0, collectionChangedCounter); collection.Add("4"); Assert.Equal(1, collectionChangedCounter); }