summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-04-12 18:46:39 +0200
committerJason Smith <jason.smith@xamarin.com>2016-04-12 09:46:39 -0700
commitc92297047c01112fd4a6e7695a40acb274fdf7a7 (patch)
tree413ce7f7a6d0507ff55ac237365924f55c49b345 /Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs
parentf975a6f2e3552c3309c8e10f15998be664d06882 (diff)
downloadxamarin-forms-c92297047c01112fd4a6e7695a40acb274fdf7a7.tar.gz
xamarin-forms-c92297047c01112fd4a6e7695a40acb274fdf7a7.tar.bz2
xamarin-forms-c92297047c01112fd4a6e7695a40acb274fdf7a7.zip
[X] internal CreateFromXaml () (#77)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs b/Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs
new file mode 100644
index 00000000..a175b57f
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/XamlLoaderCreateTests.cs
@@ -0,0 +1,38 @@
+using System;
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ [TestFixture]
+ public class XamlLoaderCreateTests
+ {
+ [Test]
+ public void CreateFromXaml ()
+ {
+ var xaml = @"
+ <ContentView xmlns=""http://xamarin.com/schemas/2014/forms""
+ xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
+ x:Class=""Xamarin.Forms.Xaml.UnitTests.FOO"">
+ <Label Text=""Foo"" x:Name=""label""/>
+ </ContentView>";
+
+ var view = XamlLoader.Create (xaml);
+ Assert.That (view, Is.TypeOf<ContentView> ());
+ Assert.AreEqual ("Foo", ((Label)((ContentView)view).Content).Text);
+ }
+
+ [Test]
+ public void CreateFromXamlDoesntFailOnMissingEventHandler ()
+ {
+ var xaml = @"
+ <Button xmlns=""http://xamarin.com/schemas/2014/forms""
+ xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
+ Clicked=""handleClick"">
+ </Button>";
+
+ Button button = null;
+ Assert.DoesNotThrow (() => button = XamlLoader.Create (xaml, true) as Button);
+ Assert.NotNull (button);
+ }
+ }
+} \ No newline at end of file