Created
February 28, 2019 23:59
-
-
Save atzimler/cfc8ab3271bb4f7e3c7e44a61e6c8041 to your computer and use it in GitHub Desktop.
ObservableCollection Example 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ItemsToBeAddedAreRejectedCorrectly() | |
{ | |
var observableCollection = new ObservableCollection<int>(); | |
observableCollection.CollectionChanged += (o, e) => | |
{ | |
if (e.Action == NotifyCollectionChangedAction.Add) | |
{ | |
observableCollection.Clear(); | |
} | |
}; | |
observableCollection.Add(13); | |
observableCollection.Count.Should().Be(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment