Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Added negative test case for ReplaceRange when no items are replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hoefling committed May 2, 2019
1 parent bfcedcb commit 41e99fa
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ public void SkipCollectionChanged_ReplaceRange_Test()
Assert.Equal(1, collectionChangedCounter);
}

[Fact]
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++;

Assert.Throws<ArgumentNullException>(() => collection.ReplaceRange(0, 0, new string[0]));
Assert.Equal(0, collectionChangedCounter);

collection.Add("1");
Assert.Equal(1, collectionChangedCounter);
}

public class NonNullObservableCollection<T> : ObservableCollection<T>
{

Expand Down

0 comments on commit 41e99fa

Please sign in to comment.