Skip to content

Commit

Permalink
Merge branch 'master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
emmauss authored Jan 26, 2022
2 parents f507ef2 + 46bdd2a commit 19176a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Avalonia.Base/Collections/AvaloniaDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public bool Remove(TKey key)
{
if (_inner.TryGetValue(key, out var value))
{
_inner.Remove(key);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]"));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
Expand Down Expand Up @@ -104,6 +105,16 @@ public void Removing_Item_Should_Raise_CollectionChanged()
Assert.Equal(new KeyValuePair<string, string>("foo", "bar"), tracker.Args.OldItems[0]);
}

[Fact]
public void Remove_Method_Should_Remove_Item_From_Collection()
{
var target = new AvaloniaDictionary<string, string>() { { "foo", "bar" } };
Assert.Equal(target.Count, 1);

target.Remove("foo");
Assert.Equal(target.Count, 0);
}

[Fact]
public void Removing_Item_Should_Raise_PropertyChanged()
{
Expand Down

0 comments on commit 19176a8

Please sign in to comment.