-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
DefaultCtorRouting2.xaml.cs
62 lines (55 loc) · 1.34 KB
/
DefaultCtorRouting2.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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;
#pragma warning disable 0618
Internals.XamlLoader.XamlFileProvider = null;
#pragma warning restore 0618
}
[Test]
public void ShouldBeCompiled()
{
var p = new DefaultCtorRouting2();
Assert.True(p.IsCompiled);
}
[Test]
public void ShouldntBeCompiled()
{
#pragma warning disable 0618
Internals.XamlLoader.XamlFileProvider = (t) => {
#pragma warning restore 0618
if (t == typeof(DefaultCtorRouting2))
return @"<?xml version=""1.0"" encoding=""UTF-8""?>
<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
x:Class=""Xamarin.Forms.Xaml.UnitTests.DefaultCtorRouting2""
IsCompiled=""IsCompiled?"">
</ContentPage>";
return null;
};
var p = new DefaultCtorRouting2();
Assert.False(p.IsCompiled);
}
}
}
}