summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs
new file mode 100644
index 00000000..35211a1b
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27299.xaml.cs
@@ -0,0 +1,58 @@
+´╗┐using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms;
+
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public class Bz27299ViewModel
+ {
+ public string Text {
+ get { return "Foo"; }
+ }
+ }
+ public class Bz27299ViewModelLocator
+ {
+ public static int Count { get; set; }
+ public object Bz27299 {
+ get {
+ Count++;
+ return new Bz27299ViewModel ();
+ }
+ }
+ }
+
+ public partial class Bz27299 : ContentPage
+ {
+ public Bz27299 ()
+ {
+ InitializeComponent ();
+ }
+ public Bz27299 (bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ class Tests
+ {
+ [SetUp]
+ public void SetUp ()
+ {
+ Bz27299ViewModelLocator.Count = 0;
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void ViewModelLocatorOnlyCalledOnce (bool useCompiledXaml)
+ {
+ Assert.AreEqual (0, Bz27299ViewModelLocator.Count);
+ var layout = new Bz27299 (useCompiledXaml);
+ Assert.AreEqual (1, Bz27299ViewModelLocator.Count);
+ Assert.AreEqual ("Foo", layout.label.Text);
+ }
+ }
+ }
+} \ No newline at end of file