diff --git a/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_SkipCollectionChangedTests.netcoreapp.cs b/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_SkipCollectionChangedTests.netcoreapp.cs index a3c94694444a..4c0569b3a24c 100644 --- a/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_SkipCollectionChangedTests.netcoreapp.cs +++ b/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_SkipCollectionChangedTests.netcoreapp.cs @@ -89,6 +89,23 @@ public void SkipCollectionChanged_ReplaceRange_Test() Assert.Equal(1, collectionChangedCounter); } + [Fact] + public void SkipCollectionChanged_ReplaceRange_Empty_Test() + { + int collectionChangedCounter = 0; + NonNullObservableCollection collection = new NonNullObservableCollection(); + collection.Add("1"); + collection.Add("2"); + collection.Add("3"); + collection.CollectionChanged += (s, e) => collectionChangedCounter++; + + Assert.Throws(() => collection.ReplaceRange(0, 0, new string[0])); + Assert.Equal(0, collectionChangedCounter); + + collection.Add("1"); + Assert.Equal(1, collectionChangedCounter); + } + public class NonNullObservableCollection : ObservableCollection {