summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-08-15 22:06:11 +0200
committerJason Smith <jason.smith@xamarin.com>2016-08-15 13:06:11 -0700
commit775df09a3e45e90128f9047e8618461d4c4411a0 (patch)
tree3bfb63278a218c9d1f753f5fdafb7de659a048b5 /Xamarin.Forms.Xaml.UnitTests
parent0390ea034694d4ad548e9f46cf6f3fa3f291d041 (diff)
downloadxamarin-forms-775df09a3e45e90128f9047e8618461d4c4411a0.tar.gz
xamarin-forms-775df09a3e45e90128f9047e8618461d4c4411a0.tar.bz2
xamarin-forms-775df09a3e45e90128f9047e8618461d4c4411a0.zip
[Xaml] x:Static in x:Arguments (#288)
* [Xaml] Support x:Static as x:Arguments * [XamlC] allow x:Static in x:Arguments * fix typo, remove commented code
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml14
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml.cs30
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs2
3 files changed, 44 insertions, 2 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml b/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml
index a90a0378..5225c7d9 100644
--- a/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml
@@ -54,5 +54,19 @@
</local:MockFactory>
</local:MockView.Content>
</local:MockView>
+ <local:MockView x:Name="v6">
+ <local:MockView.Content>
+ <local:MockFactory>
+ <x:Arguments>
+ <StaticExtension Member="local:MockxStatic.MockStaticProperty"/>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v7">
+ <local:MockView.Content>
+ <local:MockFactory x:Arguments="{x:Static local:MockxStatic.MockStaticProperty}"/>
+ </local:MockView.Content>
+ </local:MockView>
</StackLayout>
</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml.cs
index 42f359b7..9fa4e924 100644
--- a/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/FactoryMethods.xaml.cs
@@ -1,5 +1,6 @@
´╗┐using Xamarin.Forms;
using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
@@ -16,11 +17,16 @@ namespace Xamarin.Forms.Xaml.UnitTests
Content = "default ctor";
}
- public MockFactory (string arg0, string arg1)
+ public MockFactory(string arg0, string arg1)
{
Content = "alternate ctor " + arg0 + arg1;
}
+ public MockFactory(string arg0)
+ {
+ Content = "alternate ctor " + arg0;
+ }
+
public MockFactory (int arg)
{
Content = "int ctor " + arg.ToString ();
@@ -63,6 +69,12 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestFixture]
public class Tests
{
+ [SetUp]
+ public void SetUp()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
[TestCase (false)]
[TestCase (true)]
public void TestDefaultCtor (bool useCompiledXaml)
@@ -110,6 +122,22 @@ namespace Xamarin.Forms.Xaml.UnitTests
var layout = new FactoryMethods (useCompiledXaml);
Assert.AreEqual ("factory 42foo", layout.v5.Content.Content);
}
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void TestCtorWithxStatic(bool useCompiledXaml)
+ {
+ var layout = new FactoryMethods(useCompiledXaml);
+ Assert.AreEqual("alternate ctor Property", layout.v6.Content.Content);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void TestCtorWithxStaticAttribute(bool useCompiledXaml)
+ {
+ var layout = new FactoryMethods(useCompiledXaml);
+ Assert.AreEqual("alternate ctor Property", layout.v7.Content.Content);
+ }
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs
index d7476b74..cb8b22b4 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs
@@ -7,6 +7,7 @@ using NUnit.Framework;
namespace Xamarin.Forms.Xaml.UnitTests
{
+ [XamlCompilation(XamlCompilationOptions.Skip)]
public partial class StaticExtensionException : ContentPage
{
public StaticExtensionException ()
@@ -23,7 +24,6 @@ namespace Xamarin.Forms.Xaml.UnitTests
public class Issue2115
{
[TestCase (false)]
- [TestCase (true)]
public void xStaticThrowsMeaningfullException (bool useCompiledXaml)
{
Assert.Throws (new XamlParseExceptionConstraint (6, 34), () => new StaticExtensionException (useCompiledXaml));