blob: 261de06acde0fa071b0e0f03d89f05b53edc3758 (
plain)
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
|
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
[XamlCompilation(XamlCompilationOptions.Skip)]
public partial class XStaticException : ContentPage
{
public XStaticException()
{
InitializeComponent();
}
public XStaticException(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
public class Tests
{
//{x:Static Member=prefix:typeName.staticMemberName}
//{x:Static prefix:typeName.staticMemberName}
//The code entity that is referenced must be one of the following:
// - A constant
// - A static property
// - A field
// - An enumeration value
// All other cases should throw
[SetUp]
public void Setup()
{
Device.PlatformServices = new MockPlatformServices();
}
[TearDown]
public void TearDown()
{
Device.PlatformServices = null;
}
[TestCase(false)]
[TestCase(true)]
public void ThrowOnInstanceProperty(bool useCompiledXaml)
{
if (!useCompiledXaml)
Assert.Throws(new XamlParseExceptionConstraint(7, 6), () => new XStaticException(useCompiledXaml));
else
Assert.Throws(new XamlParseExceptionConstraint(7, 6), () => MockCompiler.Compile(typeof(XStaticException)));
}
}
}
}
|