|
|
@@ -1,8 +1,10 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.Specialized;
|
|
|
+
|
|
|
using Avalonia.Collections;
|
|
|
using Avalonia.Data.Core;
|
|
|
+
|
|
|
using Xunit;
|
|
|
|
|
|
namespace Avalonia.Base.UnitTests.Collections
|
|
|
@@ -156,5 +158,34 @@ namespace Avalonia.Base.UnitTests.Collections
|
|
|
|
|
|
Assert.Equal(new[] { "Count", CommonPropertyNames.IndexerName }, tracker.Names);
|
|
|
}
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void Constructor_Should_Throw_ArgumentNullException_When_Collection_Is_Null()
|
|
|
+ {
|
|
|
+ Assert.Throws<ArgumentNullException>(() =>
|
|
|
+ {
|
|
|
+ var target = new AvaloniaDictionary<string, string>(null, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void Constructor_Should_Initialize_With_Provided_Collection()
|
|
|
+ {
|
|
|
+ var initialCollection = new Dictionary<string, string>
|
|
|
+ {
|
|
|
+ { "key1", "value1" },
|
|
|
+ { "key2", "value2" }
|
|
|
+ };
|
|
|
+
|
|
|
+ var target = new AvaloniaDictionary<string, string>(initialCollection, null);
|
|
|
+
|
|
|
+ Assert.Equal(2, target.Count);
|
|
|
+ Assert.Equal("value1", target["key1"]);
|
|
|
+ Assert.Equal("value2", target["key2"]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|