summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests
diff options
context:
space:
mode:
authorRogier van der Hee <rogihee@users.noreply.github.com>2016-08-09 12:37:35 +0200
committerRui Marinho <me@ruimarinho.net>2016-08-09 11:37:35 +0100
commit43e90a38840600a2556be38cc331de4a0d948834 (patch)
tree00b9f4cdd5747fa9b716ee26a50dc2cdcede68ee /Xamarin.Forms.Core.UnitTests
parent0a73c0f4bbf75d8a83f36b031c3bfd07108ea04b (diff)
downloadxamarin-forms-43e90a38840600a2556be38cc331de4a0d948834.tar.gz
xamarin-forms-43e90a38840600a2556be38cc331de4a0d948834.tar.bz2
xamarin-forms-43e90a38840600a2556be38cc331de4a0d948834.zip
Add the key in the message on throwing a KeyNotFoundException (#282)
* Add the key in the message on throwing a KeyNotFoundException for trying to access an invalid key in the ResourceDictionary. This helps a lot in tracking down what resource is actually missing. * Fix test build, use C# 6 string interpolation
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r--Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
index d4229221..c4e6bbf3 100644
--- a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
@@ -252,5 +252,14 @@ namespace Xamarin.Forms.Core.UnitTests
elt.Parent = parent;
Assert.Fail ();
}
- }
+
+ [Test]
+ public void ShowKeyInExceptionIfNotFound()
+ {
+ var rd = new ResourceDictionary();
+ rd.Add("foo", "bar");
+ var ex = Assert.Throws<KeyNotFoundException>(() => { var foo = rd["test_invalid_key"]; });
+ Assert.That(ex.Message, Is.StringContaining("test_invalid_key"));
+ }
+ }
} \ No newline at end of file