diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-04-11 20:09:06 +0200 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2017-04-11 11:09:06 -0700 |
commit | d3cc1b5651918c9d306ec0002515371cae85262a (patch) | |
tree | 9c77998e3a5849e27c36da703e79ccdfe615ec5c /Xamarin.Forms.Core.UnitTests | |
parent | 093a4efa2da9cb681890158ca8ee9bb6f30b0a8c (diff) | |
download | xamarin-forms-d3cc1b5651918c9d306ec0002515371cae85262a.tar.gz xamarin-forms-d3cc1b5651918c9d306ec0002515371cae85262a.tar.bz2 xamarin-forms-d3cc1b5651918c9d306ec0002515371cae85262a.zip |
[C] Lookup in RD also lookup in merged RDs (#861)
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs index 3621d955..d1a43732 100644 --- a/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs +++ b/Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs @@ -290,7 +290,7 @@ namespace Xamarin.Forms.Core.UnitTests rd0.MergedWith = typeof(MyRD); object _; - Assert.True(rd0.TryGetMergedValue("foo", out _)); + Assert.True(rd0.TryGetValue("foo", out _)); Assert.AreEqual("Foo", _); } @@ -307,5 +307,56 @@ namespace Xamarin.Forms.Core.UnitTests } Assert.Fail(); } + + [Test] + public void ContainsReturnsValuesForMergedRD() + { + var rd = new ResourceDictionary { + {"baz", "BAZ"}, + {"qux", "QUX"}, + }; + rd.MergedWith = typeof(MyRD); + + Assert.That(rd.Contains(new KeyValuePair<string, object>("foo", "Foo")), Is.True); + } + + [Test] + public void CountDoesNotIncludeMerged() + { + var rd = new ResourceDictionary { + {"baz", "Baz"}, + {"qux", "Qux"}, + }; + rd.MergedWith = typeof(MyRD); + + Assert.That(rd.Count, Is.EqualTo(2)); + } + + [Test] + public void IndexerLookupInMerged() + { + var rd = new ResourceDictionary { + {"baz", "BAZ"}, + {"qux", "QUX"}, + }; + rd.MergedWith = typeof(MyRD); + + Assert.That(() => rd["foo"], Throws.Nothing); + Assert.That(rd["foo"], Is.EqualTo("Foo")); + } + + [Test] + public void TryGetValueLookupInMerged() + { + var rd = new ResourceDictionary { + {"baz", "BAZ"}, + {"qux", "QUX"}, + }; + rd.MergedWith = typeof(MyRD); + + object _; + Assert.That(rd.TryGetValue("foo", out _), Is.True); + Assert.That(rd.TryGetValue("baz", out _), Is.True); +} } }
\ No newline at end of file |