public void OnPlatformAsResourceAreApplied(bool useCompiledXaml) { ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.iOS; var layout = new OnPlatform(useCompiledXaml); var onidiom = layout.Resources ["fontSize"] as OnIdiom <double>; Assert.NotNull(onidiom); Assert.That(onidiom.Phone, Is.TypeOf <double>()); Assert.AreEqual(20, onidiom.Phone); Assert.AreEqual(FontAttributes.Bold, layout.label0.FontAttributes); ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.Android; layout = new OnPlatform(useCompiledXaml); Assert.AreEqual(FontAttributes.Italic, layout.label0.FontAttributes); }
public void OnPlatform2Syntax(bool useCompiledXaml) { ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.Android; var layout = new OnPlatform(useCompiledXaml); Assert.AreEqual(42, layout.label0.HeightRequest); ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.iOS; layout = new OnPlatform(useCompiledXaml); Assert.AreEqual(21, layout.label0.HeightRequest); ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = "FooBar"; layout = new OnPlatform(useCompiledXaml); Assert.AreEqual(42, layout.label0.HeightRequest); }