public void Clearing_Collection_Should_Raise_PropertyChanged()
        {
            var target = new AvaloniaDictionary <string, string>();

            target["foo"] = "bar";
            target["baz"] = "qux";
            var tracker = new PropertyChangedTracker(target);

            target.Clear();

            Assert.Equal(new[] { "Count", CommonPropertyNames.IndexerName }, tracker.Names);
        }
        public void Clearing_Collection_Should_Raise_CollectionChanged()
        {
            var target = new AvaloniaDictionary <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_PropertyChanged()
        {
            var target = new AvaloniaDictionary<string, string>();

            target["foo"] = "bar";
            target["baz"] = "qux";
            var tracker = new PropertyChangedTracker(target);
            target.Clear();

            Assert.Equal(new[] { "Count", "Item[]" }, tracker.Names);
        }
        public void Clearing_Collection_Should_Raise_CollectionChanged()
        {
            var target = new AvaloniaDictionary<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]);
        }