diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-01-12 21:05:41 +0100 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2017-01-12 12:05:41 -0800 |
commit | b6cb64e4930de9b16309f2d30c6bb0a2177048fd (patch) | |
tree | ae15f36d3e0e60cac6305f90520ad778de9c6ee3 /Xamarin.Forms.Core.UnitTests/ListViewTests.cs | |
parent | 3af99cbbe145a876cc9839af0adead83695b5445 (diff) | |
download | xamarin-forms-b6cb64e4930de9b16309f2d30c6bb0a2177048fd.tar.gz xamarin-forms-b6cb64e4930de9b16309f2d30c6bb0a2177048fd.tar.bz2 xamarin-forms-b6cb64e4930de9b16309f2d30c6bb0a2177048fd.zip |
[C] new OnPlatform mechanism (#658)
* [C] Obsolete TargetPlatform
* [Xaml] support and test the new syntax
* blind fix windows platforms
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/ListViewTests.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/ListViewTests.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ListViewTests.cs b/Xamarin.Forms.Core.UnitTests/ListViewTests.cs index b373696a..329ba86c 100644 --- a/Xamarin.Forms.Core.UnitTests/ListViewTests.cs +++ b/Xamarin.Forms.Core.UnitTests/ListViewTests.cs @@ -1472,20 +1472,20 @@ namespace Xamarin.Forms.Core.UnitTests Assert.That (cell.Parent, Is.Null); } - [TestCase (TargetPlatform.Android, ListViewCachingStrategy.RecycleElement)] - [TestCase (TargetPlatform.iOS, ListViewCachingStrategy.RecycleElement)] - [TestCase (TargetPlatform.Windows, ListViewCachingStrategy.RetainElement)] - [TestCase (TargetPlatform.Other, ListViewCachingStrategy.RetainElement)] - [TestCase (TargetPlatform.WinPhone, ListViewCachingStrategy.RetainElement)] - public void EnforcesCachingStrategy (TargetPlatform platform, ListViewCachingStrategy expected) - { - var oldOS = Device.OS; + [TestCase (Device.Android, ListViewCachingStrategy.RecycleElement)] + [TestCase (Device.iOS, ListViewCachingStrategy.RecycleElement)] + [TestCase (Device.Windows, ListViewCachingStrategy.RetainElement)] + [TestCase ("Other", ListViewCachingStrategy.RetainElement)] + [TestCase (Device.WinPhone, ListViewCachingStrategy.RetainElement)] + public void EnforcesCachingStrategy (string platform, ListViewCachingStrategy expected) + { + var oldOS = Device.RuntimePlatform; // we need to do this because otherwise we cant set the caching strategy - Device.OS = platform; + ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = platform; var listView = new ListView (ListViewCachingStrategy.RecycleElement); Assert.AreEqual (expected, listView.CachingStrategy); - Device.OS = oldOS; + ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = oldOS; } [Test] @@ -1504,9 +1504,9 @@ namespace Xamarin.Forms.Core.UnitTests "Bar" }; - var oldOS = Device.OS; + var oldOS = Device.RuntimePlatform; // we need to do this because otherwise we cant set the caching strategy - Device.OS = TargetPlatform.Android; + ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.Android; var bindable = new ListView (ListViewCachingStrategy.RecycleElement); bindable.ItemTemplate = new DataTemplate (typeof (TextCell)) { @@ -1521,7 +1521,7 @@ namespace Xamarin.Forms.Core.UnitTests Assert.False(ReferenceEquals (item1, item2)); - Device.OS = oldOS; + ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = oldOS; } } } |