summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/DynamicResource.xaml.cs
blob: 703313c4ea1d73ce6716656a1fe8132cd1c92b0b (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
using System;
using System.Collections.Generic;

using NUnit.Framework;

using Xamarin.Forms;

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

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

		[TestFixture]
		public class Tests
		{
			[TestCase (false)]
			[TestCase (true)]
			public void TestDynamicResources (bool useCompiledXaml)
			{
				var layout = new DynamicResource (useCompiledXaml);
				var label = layout.label0;

				Assert.Null (label.Text);

				layout.Resources = new ResourceDictionary { 
					{"FooBar", "FOOBAR"},
				};
				Assert.AreEqual ("FOOBAR", label.Text);
			}
		}
	}
}