blob: 5b6f3e60cdaa7a3643a83830ff867c341accefc9 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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);
}
}
}
|