summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/SetValue.xaml1
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs33
2 files changed, 34 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml
index 75784273..4beec041 100644
--- a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml
@@ -84,5 +84,6 @@
</ContentView.Content>
</ContentView>
<local:MockViewWithValues x:Name="mockView0" UShort="32" ADecimal="42" />
+ <local:ViewWithEnums x:Name="enums" IntEnum="Foo" ByteEnum="Bar" />
</StackLayout>
</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs
index 3343ed7a..c6c362c2 100644
--- a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs
@@ -20,6 +20,26 @@ namespace Xamarin.Forms.Xaml.UnitTests
public decimal ADecimal { get; set; }
}
+ public enum IntEnum
+ {
+ Foo,
+ Bar,
+ Baz
+ }
+
+ public enum ByteEnum : byte
+ {
+ Foo,
+ Bar,
+ Baz
+ }
+
+ public class ViewWithEnums : View
+ {
+ public IntEnum IntEnum { get; set; }
+ public ByteEnum ByteEnum { get; set; }
+ }
+
public partial class SetValue : ContentPage
{
public SetValue ()
@@ -243,6 +263,19 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.AreEqual((ushort)32, page.mockView0.UShort);
Assert.AreEqual((decimal)42, page.mockView0.ADecimal);
}
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void NonIntEnums(bool useCompiledXaml)
+ {
+ if (useCompiledXaml) {
+ MockCompiler.Compile(typeof(SetValue));
+ return;
+ }
+ var page = new SetValue(useCompiledXaml);
+ Assert.AreEqual(IntEnum.Foo, page.enums.IntEnum);
+ Assert.AreEqual(ByteEnum.Bar, page.enums.ByteEnum);
+ }
}
}
} \ No newline at end of file