diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-02-01 21:17:15 +0100 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:17:13 +0900 |
commit | a0ae9ae55226ae6d9080830a357779e32a8f1ecc (patch) | |
tree | 43edb08cf5f143018a2ae7ec3b84a82d3919b4c5 /Xamarin.Forms.Core.UnitTests | |
parent | c0030930c4ea2af680b598baa0f7b8f767c37a9f (diff) | |
download | xamarin-forms-a0ae9ae55226ae6d9080830a357779e32a8f1ecc.tar.gz xamarin-forms-a0ae9ae55226ae6d9080830a357779e32a8f1ecc.tar.bz2 xamarin-forms-a0ae9ae55226ae6d9080830a357779e32a8f1ecc.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.cs | 14 |
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 |