summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-02-01 21:17:15 +0100
committerSamantha Houts <samantha@teamredwall.com>2017-02-01 12:17:15 -0800
commit8d4e38a86fc87690507a14fb0704c9ea5fbfeab2 (patch)
treea2c6248eff762f5331430dc0ae286a988e6c4f3e /Xamarin.Forms.Core.UnitTests
parentd598d5efe3ead3b57b18421253ccf05eefacfdd0 (diff)
downloadxamarin-forms-8d4e38a86fc87690507a14fb0704c9ea5fbfeab2.tar.gz
xamarin-forms-8d4e38a86fc87690507a14fb0704c9ea5fbfeab2.tar.bz2
xamarin-forms-8d4e38a86fc87690507a14fb0704c9ea5fbfeab2.zip
[C] throw meaningful exception on duplicate RD key (#716)
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r--Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
index e5b8b60d..9a2c6f01 100644
--- a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
@@ -292,5 +292,19 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.True(rd0.TryGetMergedValue("foo", out _));
Assert.AreEqual("Foo", _);
}
+
+ [Test]
+ public void ThrowOnDuplicateKey()
+ {
+ var rd0 = new ResourceDictionary();
+ rd0.Add("foo", "Foo");
+ try {
+ rd0.Add("foo", "Bar");
+ } catch (ArgumentException ae) {
+ Assert.AreEqual("A resource with the key 'foo' is already present in the ResourceDictionary.", ae.Message);
+ Assert.Pass();
+ }
+ Assert.Fail();
+ }
}
} \ No newline at end of file