diff options
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs new file mode 100644 index 00000000..ff1f0199 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class MockxStatic + { + public static string MockStaticProperty { get { return "Property"; } } + public const string MockConstant = "Constant"; + public static string MockField = "Field"; + public string InstanceProperty { get { return "InstanceProperty"; } } + public static readonly Color BackgroundColor = Color.Fuchsia; + } + + public enum MockEnum + { + First, + Second, + Third, + } + + public partial class XStatic : ContentPage + { + public XStatic () + { + InitializeComponent (); + } + public XStatic (bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class Tests + { + [TestCase (false)] + [TestCase (true)] + public void StaticProperty (bool useCompiledXaml) + { + var layout = new XStatic (useCompiledXaml); + Assert.AreEqual ("Property", layout.staticproperty.Text); + } + + [TestCase (false)] + [TestCase (true)] + public void MemberOptional (bool useCompiledXaml) + { + var layout = new XStatic (useCompiledXaml); + Assert.AreEqual ("Property", layout.memberisoptional.Text); + } + + [TestCase (false)] + [TestCase (true)] + public void FieldColor (bool useCompiledXaml) + { + var layout = new XStatic (useCompiledXaml); + Assert.AreEqual (Color.Fuchsia, layout.color.TextColor); + } + } + } +}
\ No newline at end of file |