-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
ViewCellTests.cs
63 lines (54 loc) · 1.34 KB
/
ViewCellTests.cs
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
using System;
using NUnit.Framework;
namespace Xamarin.Forms.Core.UnitTests
{
[TestFixture]
public class ViewCellTests : BaseTestFixture
{
[Test]
public void SetParentBeforeView ()
{
var parent = new View();
var child = new View ();
var viewCell = new ViewCell ();
Assert.Null (viewCell.View);
Assert.DoesNotThrow (() => viewCell.Parent = parent);
viewCell.View = child;
Assert.AreSame (parent, viewCell.Parent);
Assert.AreSame (viewCell, child.Parent);
}
[Test]
//issue 550
public void SetBindingContextBeforeParent ()
{
var parent = new View {
BindingContext = new object (),
};
var itemcontext = new object ();
var cell = new ViewCell { View = new Label ()};
cell.BindingContext = itemcontext;
cell.Parent = parent;
Assert.AreSame (itemcontext, cell.View.BindingContext);
}
[Test]
public void SetBindingContextBeforeView ()
{
var context = new object ();
var view = new View ();
var cell = new ViewCell ();
cell.BindingContext = context;
cell.View = view;
Assert.AreSame (context, view.BindingContext);
}
[Test]
public void SetViewBeforeBindingContext ()
{
var context = new object ();
var view = new View ();
var cell = new ViewCell ();
cell.View = view;
cell.BindingContext = context;
Assert.AreSame (context, view.BindingContext);
}
}
}