summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2489.xaml.cs
blob: ad79298e181acbf7e8e5fe95b43908d0e1d71f88 (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 System.Linq;
using System.Collections.Generic;

using Xamarin.Forms;

using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public partial class Issue2489 : ContentPage
	{
		public Issue2489 ()
		{
			InitializeComponent ();
		}

		public Issue2489 (bool useCompiledXaml)
		{
			//this stub will be replaced at compile time
		}

		[TestFixture]
		public class Tests
		{
			[SetUp]
			public void SetUp ()
			{
				Device.PlatformServices = new MockPlatformServices ();
			}

			[TestCase (false)]
			[TestCase (true)]
			public void DataTriggerTargetType (bool useCompiledXaml)
			{
				var layout = new Issue2489 (useCompiledXaml);
				Assert.NotNull (layout.wimage);
				Assert.NotNull (layout.wimage.Triggers);
				Assert.True (layout.wimage.Triggers.Any ());
				Assert.That (layout.wimage.Triggers [0], Is.TypeOf<DataTrigger> ());
				var trigger = (DataTrigger)layout.wimage.Triggers [0];
				Assert.AreEqual (typeof(WImage), trigger.TargetType);
			}
		}
	}

	public class WImage: View
	{
		public ImageSource Source { get; set; }
		public Aspect Aspect { get; set; }
	}
}