using NUnit.Framework; using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { public partial class DefaultCtorRouting2 : ContentPage { [TypeConverter(typeof(IsCompiledTypeConverter))] public bool IsCompiled { get; set; } public DefaultCtorRouting2() { InitializeComponent(); } [TestFixture] class Tests { [SetUp] public void Setup() { Device.PlatformServices = new MockPlatformServices(); } [TearDown] public void TearDown() { Device.PlatformServices = null; Internals.XamlLoader.XamlFileProvider = null; } [Test] public void ShouldBeCompiled() { var p = new DefaultCtorRouting2(); Assert.True(p.IsCompiled); } [Test] public void ShouldntBeCompiled() { Internals.XamlLoader.XamlFileProvider = (t) => { if (t == typeof(DefaultCtorRouting2)) return @" "; return null; }; var p = new DefaultCtorRouting2(); Assert.False(p.IsCompiled); } } } }