blob: d6ee1886eac721ca12bce6591eca5acad6ebcf12 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
using System;
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
[TestFixture]
public class FactoryMethodTests : BaseTestFixture
{
[Test]
public void ThrowOnMissingCtor ()
{
var xaml = @"
<local:MockView
xmlns=""http://xamarin.com/schemas/2014/forms""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"" >
<local:MockView.Content>
<local:MockFactory>
<x:Arguments>
<x:Object/>
<x:String>bar</x:String>
<x:Int32>42</x:Int32>
</x:Arguments>
</local:MockFactory>
</local:MockView.Content>
</local:MockView>";
Assert.Throws<MissingMethodException> (()=>new MockView ().LoadFromXaml (xaml));
}
[Test]
public void ThrowOnMissingMethod ()
{
var xaml = @"
<local:MockView
xmlns=""http://xamarin.com/schemas/2014/forms""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"" >
<local:MockView.Content>
<local:MockFactory x:FactoryMethod=""Factory"">
<x:Arguments>
<x:Object/>
<x:String>bar</x:String>
<x:Int32>42</x:Int32>
</x:Arguments>
</local:MockFactory>
</local:MockView.Content>
</local:MockView>";
Assert.Throws<MissingMemberException> (()=>new MockView ().LoadFromXaml (xaml));
}
}
}
|