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

using Xamarin.Forms;

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

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

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

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

			[TearDown]
			public void TearDown()
			{
				Device.PlatformServices = null;
			}

			[TestCase(false)]
			[TestCase(true)]
			public void EscapedStringsAreTreatedAsLiterals (bool useCompiledXaml)
			{
				var layout = new StringLiterals (useCompiledXaml);
				Assert.AreEqual ("Foo", layout.label0.Text);
				Assert.AreEqual ("{Foo}", layout.label1.Text);
				Assert.AreEqual ("Foo", layout.label2.Text);
				Assert.AreEqual ("Foo", layout.label3.Text);
			}
		}
	}
}