forked from MaterialDesignInXAML/MaterialDesignInXamlToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataGridAssistTests.cs
123 lines (104 loc) · 4.93 KB
/
DataGridAssistTests.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System.Windows;
using System.Windows.Controls;
using Xunit;
namespace MaterialDesignThemes.Wpf.Tests
{
public class DataGridAssistTests
{
private readonly DataGrid _testElement;
public DataGridAssistTests()
{
_testElement = new DataGrid();
}
[StaFact]
public void TestAutoGeneratedCheckBoxStyleProperty()
{
// Assert defaults
Assert.Equal("AutoGeneratedCheckBoxStyle", DataGridAssist.AutoGeneratedCheckBoxStyleProperty.Name);
Assert.Equal(default, DataGridAssist.GetAutoGeneratedCheckBoxStyle(_testElement));
// Assert setting works
var style = new Style();
DataGridAssist.SetAutoGeneratedCheckBoxStyle(_testElement, style);
Assert.Equal(style, DataGridAssist.GetAutoGeneratedCheckBoxStyle(_testElement));
}
[StaFact]
public void TestAutoGeneratedEditingCheckBoxStyleProperty()
{
// Assert defaults
Assert.Equal("AutoGeneratedEditingCheckBoxStyle", DataGridAssist.AutoGeneratedEditingCheckBoxStyleProperty.Name);
Assert.Equal(default, DataGridAssist.GetAutoGeneratedEditingCheckBoxStyle(_testElement));
// Assert setting works
var style = new Style();
DataGridAssist.SetAutoGeneratedEditingCheckBoxStyle(_testElement, style);
Assert.Equal(style, DataGridAssist.GetAutoGeneratedEditingCheckBoxStyle(_testElement));
}
[StaFact]
public void TestAutoGeneratedTextStyleProperty()
{
// Assert defaults
Assert.Equal("AutoGeneratedTextStyle", DataGridAssist.AutoGeneratedTextStyleProperty.Name);
Assert.Equal(default, DataGridAssist.GetAutoGeneratedTextStyle(_testElement));
// Assert setting works
var style = new Style();
DataGridAssist.SetAutoGeneratedTextStyle(_testElement, style);
Assert.Equal(style, DataGridAssist.GetAutoGeneratedTextStyle(_testElement));
}
[StaFact]
public void TestAutoGeneratedEditingTextStyleProperty()
{
// Assert defaults
Assert.Equal("AutoGeneratedEditingTextStyle", DataGridAssist.AutoGeneratedEditingTextStyleProperty.Name);
Assert.Equal(default, DataGridAssist.GetAutoGeneratedEditingTextStyle(_testElement));
// Assert setting works
var style = new Style();
DataGridAssist.SetAutoGeneratedEditingTextStyle(_testElement, style);
Assert.Equal(style, DataGridAssist.GetAutoGeneratedEditingTextStyle(_testElement));
}
[StaFact]
public void TestCellPaddingProperty()
{
// Assert defaults
var defaultCellPadding = new Thickness(16, 8, 16, 8);
Assert.Equal("CellPadding", DataGridAssist.CellPaddingProperty.Name);
Assert.Equal(defaultCellPadding, DataGridAssist.GetCellPadding(_testElement));
// Assert setting works
var thickness = new Thickness(2, 8, 1, 8);
DataGridAssist.SetCellPadding(_testElement, thickness);
Assert.Equal(thickness, DataGridAssist.GetCellPadding(_testElement));
}
[StaFact]
public void TestColumnHeaderPaddingProperty()
{
// Assert defaults
var defaultColumnHeaderPadding = new Thickness(16, 10, 16, 10);
Assert.Equal("ColumnHeaderPadding", DataGridAssist.ColumnHeaderPaddingProperty.Name);
Assert.Equal(defaultColumnHeaderPadding, DataGridAssist.GetColumnHeaderPadding(_testElement));
// Assert setting works
var thickness = new Thickness(1, 13, 144, -4);
DataGridAssist.SetColumnHeaderPadding(_testElement, thickness);
Assert.Equal(thickness, DataGridAssist.GetColumnHeaderPadding(_testElement));
}
[StaFact]
public void TestEnableEditBoxAssistProperty()
{
// Assert defaults
Assert.Equal("EnableEditBoxAssist", DataGridAssist.EnableEditBoxAssistProperty.Name);
Assert.Equal(default, DataGridAssist.GetEnableEditBoxAssist(_testElement));
// Assert setting works
DataGridAssist.SetEnableEditBoxAssist(_testElement, true);
Assert.True(DataGridAssist.GetEnableEditBoxAssist(_testElement));
}
[StaFact]
public void TestCornerRadiusProperty()
{
// Assert defaults
var defaultCornerRadius = new CornerRadius(4);
Assert.Equal("CornerRadius", DataGridAssist.CornerRadiusProperty.Name);
Assert.Equal(defaultCornerRadius, DataGridAssist.GetCornerRadius(_testElement));
// Assert setting works
var cornerRadius = new CornerRadius(11);
DataGridAssist.SetCornerRadius(_testElement, cornerRadius);
Assert.Equal(cornerRadius, DataGridAssist.GetCornerRadius(_testElement));
}
}
}