Browse Source

Add test to AvaloniaList.AddRange to notify Count property changed

Kaktusbot 3 years ago
parent
commit
5eca6cc83e
1 changed files with 17 additions and 0 deletions
  1. 17 0
      tests/Avalonia.Base.UnitTests/Collections/AvaloniaListTests.cs

+ 17 - 0
tests/Avalonia.Base.UnitTests/Collections/AvaloniaListTests.cs

@@ -146,6 +146,23 @@ namespace Avalonia.Base.UnitTests.Collections
             Assert.True(raised);
         }
 
+        [Fact]
+        public void AddRange_IEnumerable_Should_Raise_Count_PropertyChanged()
+        {
+            var target = new AvaloniaList<int>(new[] { 1, 2, 3, 4, 5 });
+            var raised = false;
+
+            target.PropertyChanged += (s, e) => {
+                Assert.Equal(e.PropertyName, nameof(target.Count));
+                Assert.Equal(target.Count, 7);
+                raised = true;
+            };
+
+            target.AddRange(Enumerable.Range(6, 2));
+
+            Assert.True(raised);
+        }
+
         [Fact]
         public void AddRange_Items_Should_Raise_Correct_CollectionChanged()
         {