Skip to content

Commit f458d51

Browse files
committed
Added unit tests
1 parent 36f46be commit f458d51

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

UnitTests/UnitTests.UWP/UI/Triggers/Test_ControlSizeTrigger.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,74 @@ await App.DispatcherQueue.EnqueueAsync(() =>
3737
});
3838
}
3939

40+
[DataTestMethod]
41+
[DataRow(400, 400, true)]
42+
[DataRow(400, 399, false)]
43+
public async Task ControlSizeMinHeightTriggerTest(double width, double height, bool expectedResult)
44+
{
45+
await App.DispatcherQueue.EnqueueAsync(() =>
46+
{
47+
Grid grid = CreateGrid(width, height);
48+
var trigger = new ControlSizeTrigger();
49+
50+
trigger.TargetElement = grid;
51+
trigger.MinHeight = 400;
52+
53+
Assert.AreEqual(expectedResult, trigger.IsActive);
54+
});
55+
}
56+
57+
[DataTestMethod]
58+
[DataRow(399, 400, false)]
59+
[DataRow(400, 400, true)]
60+
public async Task ControlSizeMinWidthTriggerTest(double width, double height, bool expectedResult)
61+
{
62+
await App.DispatcherQueue.EnqueueAsync(() =>
63+
{
64+
Grid grid = CreateGrid(width, height);
65+
var trigger = new ControlSizeTrigger();
66+
67+
trigger.TargetElement = grid;
68+
trigger.MinWidth = 400;
69+
70+
Assert.AreEqual(expectedResult, trigger.IsActive);
71+
});
72+
}
73+
74+
[DataTestMethod]
75+
[DataRow(450, 450, false)]
76+
[DataRow(450, 449, true)]
77+
public async Task ControlSizeMaxHeightTriggerTest(double width, double height, bool expectedResult)
78+
{
79+
await App.DispatcherQueue.EnqueueAsync(() =>
80+
{
81+
Grid grid = CreateGrid(width, height);
82+
var trigger = new ControlSizeTrigger();
83+
84+
trigger.TargetElement = grid;
85+
trigger.MaxHeight = 450;
86+
87+
Assert.AreEqual(expectedResult, trigger.IsActive);
88+
});
89+
}
90+
91+
[DataTestMethod]
92+
[DataRow(450, 450, false)]
93+
[DataRow(449, 450, true)]
94+
public async Task ControlSizeMaxWidthTriggerTest(double width, double height, bool expectedResult)
95+
{
96+
await App.DispatcherQueue.EnqueueAsync(() =>
97+
{
98+
Grid grid = CreateGrid(width, height);
99+
var trigger = new ControlSizeTrigger();
100+
101+
trigger.TargetElement = grid;
102+
trigger.MaxWidth = 450;
103+
104+
Assert.AreEqual(expectedResult, trigger.IsActive);
105+
});
106+
}
107+
40108
private Grid CreateGrid(double width, double height)
41109
{
42110
var grid = new Grid()

0 commit comments

Comments
 (0)