blob: a175b57f8745d437ff032ff365909411d95ab361 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
}
}
}
|