blob: ca239af7dde315269a1b6c9d2ffba30d5ba75495 (
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
56
57
58
59
60
61
62
63
|
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using System.Globalization;
using NUnit.Framework;
namespace Xamarin.Forms.Xaml.UnitTests
{
public class GrialIssue02Converter : IValueConverter
{
public object FalseValue {
get;
set;
}
public object TrueValue {
get;
set;
}
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is bool)) {
return null;
}
bool flag = (bool)value;
return (!flag) ? FalseValue : TrueValue;
}
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException ();
}
}
public partial class GrialIssue02 : ContentPage
{
public GrialIssue02 ()
{
InitializeComponent ();
}
public GrialIssue02 (bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
class Tests
{
[TestCase(true)]
[TestCase(false)]
public void BoxValueTypes (bool useCompiledXaml)
{
var layout = new GrialIssue02 (useCompiledXaml);
var res = (GrialIssue02Converter)layout.Resources ["converter"];
Assert.AreEqual (FontAttributes.None, res.TrueValue);
Assert.AreEqual (FontAttributes.Bold, res.FalseValue);
}
}
}
}
|