summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs')
-rw-r--r--Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs b/Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs
new file mode 100644
index 00000000..5b6f3e60
--- /dev/null
+++ b/Xamarin.Forms.Core.UnitTests/ContentFormUnitTests.cs
@@ -0,0 +1,68 @@
+´╗┐using System;
+using System.Linq;
+using NUnit.Framework;
+
+
+namespace Xamarin.Forms.Core.UnitTests
+{
+ [TestFixture]
+ public class ContentPageUnitTests : BaseTestFixture
+ {
+ [Test]
+ public void PropagateBindingContextBefore()
+ {
+ var stack = new StackLayout();
+
+ var content = new ContentPage();
+ content.Content = stack;
+
+ object context = new object();
+ content.BindingContext = context;
+
+ Assert.AreSame (context, stack.BindingContext);
+ }
+
+ [Test]
+ public void PropagateBindingContextAfter()
+ {
+ var stack = new StackLayout();
+
+ var content = new ContentPage();
+
+ object context = new object();
+ content.BindingContext = context;
+
+ content.Content = stack;
+
+ Assert.AreSame (context, stack.BindingContext);
+ }
+
+ [Test]
+ public void PropagateToolbarItemBindingContextPreAdd ()
+ {
+ var page = new ContentPage ();
+ object context = "hello";
+
+ var toolbarItem = new ToolbarItem ();
+ page.ToolbarItems.Add (toolbarItem);
+
+ page.BindingContext = context;
+
+ Assert.AreEqual (context, toolbarItem.BindingContext);
+ }
+
+ [Test]
+ public void PropagateToolbarItemBindingContextPostAdd ()
+ {
+ var page = new ContentPage ();
+ object context = "hello";
+
+ var toolbarItem = new ToolbarItem ();
+ page.BindingContext = context;
+
+ page.ToolbarItems.Add (toolbarItem);
+
+ Assert.AreEqual (context, toolbarItem.BindingContext);
+ }
+ }
+}