diff options
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs index ff1f0199..d8a466e9 100644 --- a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; - -using Xamarin.Forms; - -using NUnit.Framework; +using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { @@ -16,7 +12,7 @@ namespace Xamarin.Forms.Xaml.UnitTests public static readonly Color BackgroundColor = Color.Fuchsia; } - public enum MockEnum + public enum MockEnum : long { First, Second, @@ -37,6 +33,28 @@ namespace Xamarin.Forms.Xaml.UnitTests [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 StaticProperty (bool useCompiledXaml) @@ -60,6 +78,30 @@ namespace Xamarin.Forms.Xaml.UnitTests var layout = new XStatic (useCompiledXaml); Assert.AreEqual (Color.Fuchsia, layout.color.TextColor); } + + [TestCase(false)] + [TestCase(true)] + public void Constant(bool useCompiledXaml) + { + var layout = new XStatic(useCompiledXaml); + Assert.AreEqual("Constant", layout.constant.Text); + } + + [TestCase(false)] + [TestCase(true)] + public void Field(bool useCompiledXaml) + { + var layout = new XStatic(useCompiledXaml); + Assert.AreEqual("Field", layout.field.Text); + } + + [TestCase(false)] + [TestCase(true)] + public void Enum(bool useCompiledXaml) + { + var layout = new XStatic(useCompiledXaml); + Assert.AreEqual(ScrollOrientation.Both, layout.enuM.Orientation); + } } } }
\ No newline at end of file |