diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Xaml.UnitTests/Validation | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Validation')
6 files changed, 132 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml new file mode 100644 index 00000000..87252208 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ContentPage + xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + x:Class="Xamarin.Forms.Xaml.UnitTests.SetterOnNonBP" + xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"> + <local:FakeVisualElement> + <local:FakeVisualElement.Style> + <Style TargetType="local:FakeVisualElement"> + <Setter Property="NonBindable" Value="Should Fail"/> + </Style> + </local:FakeVisualElement.Style> + </local:FakeVisualElement> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs new file mode 100644 index 00000000..f6d8ffea --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs @@ -0,0 +1,34 @@ +using NUnit.Framework; + +using Xamarin.Forms; +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class FakeVisualElement : VisualElement + { + public string NonBindable { get; set; } + } + + public partial class SetterOnNonBP : ContentPage + { + public SetterOnNonBP () + { + InitializeComponent (); + } + + public SetterOnNonBP (bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class SetterOnNonBPTests + { + [TestCase (false)] + [TestCase (true)] + public void ShouldThrow (bool useCompiledXaml) + { + Assert.Throws (new XamlParseExceptionConstraint (10, 13), () => new SetterOnNonBP (useCompiledXaml)); + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml b/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml new file mode 100644 index 00000000..b8dc5b5d --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.StaticExtensionException"> + <ContentPage.Resources> + <ResourceDictionary> + <Style TargetType="Label" x:Key="foo"> + <Setter Property="TextColor" Value="{x:Static local:Colors.ButtonText}"/> + </Style> + </ResourceDictionary> + </ContentPage.Resources> +</ContentPage>
\ 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 new file mode 100644 index 00000000..d7476b74 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/StaticExtensionException.xaml.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public partial class StaticExtensionException : ContentPage + { + public StaticExtensionException () + { + InitializeComponent (); + } + + public StaticExtensionException (bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class Issue2115 + { + [TestCase (false)] + [TestCase (true)] + public void xStaticThrowsMeaningfullException (bool useCompiledXaml) + { + Assert.Throws (new XamlParseExceptionConstraint (6, 34), () => new StaticExtensionException (useCompiledXaml)); + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml b/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml new file mode 100644 index 00000000..6b994bba --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ContentPage + xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + x:Class="Xamarin.Forms.Xaml.UnitTests.TypeMismatch"> + <StackLayout> + <ContentView Content="foobar"/> + </StackLayout> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml.cs new file mode 100644 index 00000000..43a4459c --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Validation/TypeMismatch.xaml.cs @@ -0,0 +1,32 @@ +using System; + +using Xamarin.Forms; + +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public partial class TypeMismatch : ContentPage + { + public TypeMismatch () + { + InitializeComponent (); + } + + public TypeMismatch (bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class Tests + { + [TestCase (false)] +// [TestCase (true)] + public void ThrowsOnMismatchingType (bool useCompiledXaml) + { + Assert.Throws (new XamlParseExceptionConstraint (7, 16, m => m.StartsWith ("Cannot assign property", StringComparison.Ordinal)), () => new TypeMismatch (useCompiledXaml)); + } + } + } +}
\ No newline at end of file |