public void Assigning_Item_Should_Raise_CollectionChanged_Add() { var target = new PerspexDictionary<string, string>(); var tracker = new CollectionChangedTracker(target); target["foo"] = "bar"; Assert.NotNull(tracker.Args); Assert.Equal(NotifyCollectionChangedAction.Add, tracker.Args.Action); Assert.Equal(-1, tracker.Args.NewStartingIndex); Assert.Equal(1, tracker.Args.NewItems.Count); Assert.Equal(new KeyValuePair<string, string>("foo", "bar"), tracker.Args.NewItems[0]); }
public void Assigning_Item_Should_Raise_CollectionChanged_Add() { var target = new PerspexDictionary <string, string>(); var tracker = new CollectionChangedTracker(target); target["foo"] = "bar"; Assert.NotNull(tracker.Args); Assert.Equal(NotifyCollectionChangedAction.Add, tracker.Args.Action); Assert.Equal(-1, tracker.Args.NewStartingIndex); Assert.Equal(1, tracker.Args.NewItems.Count); Assert.Equal(new KeyValuePair <string, string>("foo", "bar"), tracker.Args.NewItems[0]); }
public void Clearing_Collection_Should_Raise_CollectionChanged() { var target = new PerspexDictionary <string, string>(); target["foo"] = "bar"; target["baz"] = "qux"; var tracker = new CollectionChangedTracker(target); target.Clear(); Assert.NotNull(tracker.Args); Assert.Equal(NotifyCollectionChangedAction.Remove, tracker.Args.Action); Assert.Equal(-1, tracker.Args.OldStartingIndex); Assert.Equal(2, tracker.Args.OldItems.Count); Assert.Equal(new KeyValuePair <string, string>("foo", "bar"), tracker.Args.OldItems[0]); }
public void Clearing_Collection_Should_Raise_CollectionChanged() { var target = new PerspexDictionary<string, string>(); target["foo"] = "bar"; target["baz"] = "qux"; var tracker = new CollectionChangedTracker(target); target.Clear(); Assert.NotNull(tracker.Args); Assert.Equal(NotifyCollectionChangedAction.Remove, tracker.Args.Action); Assert.Equal(-1, tracker.Args.OldStartingIndex); Assert.Equal(2, tracker.Args.OldItems.Count); Assert.Equal(new KeyValuePair<string, string>("foo", "bar"), tracker.Args.OldItems[0]); }