summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs
new file mode 100644
index 00000000..ca239af7
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/GrialIssue02.xaml.cs
@@ -0,0 +1,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);
+ }
+ }
+ }
+} \ No newline at end of file