blob: fde0e777b29228f7561a819c2dc097ead18624b5 (
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
|
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace Xamarin.Forms.Xaml.UnitTests
{
public partial class FieldModifier : ContentPage
{
public FieldModifier()
{
InitializeComponent();
}
public FieldModifier (bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
public class FindByNameTests
{
[TestCase (false)]
[TestCase (true)]
public void TestFieldModifier (bool useCompiledXaml)
{
var layout = new FieldModifier();
Assert.That(layout.privateLabel, Is.Not.Null);
Assert.That(layout.internalLabel, Is.Not.Null);
Assert.That(layout.publicLabel, Is.Not.Null);
var fields = typeof(FieldModifier).GetTypeInfo().DeclaredFields;
Assert.That(fields.First(fi => fi.Name == "privateLabel").IsPrivate, Is.True);
Assert.That(fields.First(fi => fi.Name == "internalLabel").IsPrivate, Is.False);
Assert.That(fields.First(fi => fi.Name == "internalLabel").IsPublic, Is.False);
Assert.That(fields.First(fi => fi.Name == "publicLabel").IsPublic, Is.True);
}
}
}
}
|