Dreamine.UI.WinForms.Tests
1.0.0.0
Dreamine.UI.WinForms.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DreamineButtonTests.cs
이 파일의 문서화 페이지로 가기
1
using
System.Drawing;
2
using
System.Windows.Input;
3
using
Dreamine.UI.WinForms.Controls;
4
using
Xunit;
5
6
namespace
Dreamine.UI.WinForms.Tests.Controls
;
7
16
public
class
DreamineButtonTests
17
{
26
[Fact]
27
public
void
DefaultContent_IsEmpty
()
28
{
29
var btn =
new
DreamineButton();
30
Assert.Equal(
string
.Empty, btn.Content);
31
}
32
41
[Fact]
42
public
void
Content_SetAndGet_Roundtrip
()
43
{
44
var btn =
new
DreamineButton { Content =
"Click Me"
};
45
Assert.Equal(
"Click Me"
, btn.Content);
46
}
47
56
[Fact]
57
public
void
ShineColor_DefaultIsEmpty
()
58
{
59
var btn =
new
DreamineButton();
60
Assert.Equal(Color.Empty, btn.ShineColor);
61
}
62
71
[Fact]
72
public
void
ShineColor_SetAndGet_Roundtrip
()
73
{
74
var btn =
new
DreamineButton { ShineColor = Color.Blue };
75
Assert.Equal(Color.Blue, btn.ShineColor);
76
}
77
86
[Fact]
87
public
void
IsSelected_DefaultIsFalse
()
88
{
89
var btn =
new
DreamineButton();
90
Assert.False(btn.IsSelected);
91
}
92
101
[Fact]
102
public
void
IsSelected_ToggleWorks
()
103
{
104
var btn =
new
DreamineButton { IsSelected =
true
};
105
Assert.True(btn.IsSelected);
106
btn.IsSelected =
false
;
107
Assert.False(btn.IsSelected);
108
}
109
118
[Fact]
119
public
void
CornerRadius_DefaultIsPositive
()
120
{
121
var btn =
new
DreamineButton();
122
Assert.True(btn.CornerRadius > 0);
123
}
124
133
[Fact]
134
public
void
Command_Execute_InvokesAction
()
135
{
136
bool
executed =
false
;
137
var btn =
new
DreamineButton
138
{
139
Command =
new
RelayTestCommand
(_ => executed =
true
)
140
};
141
btn.Command.Execute(
null
);
142
Assert.True(executed);
143
}
144
153
[Fact]
154
public
void
CommandParameter_SetAndGet_Roundtrip
()
155
{
156
var param =
new
object();
157
var btn =
new
DreamineButton { CommandParameter = param };
158
Assert.Same(param, btn.CommandParameter);
159
}
160
169
[Fact]
170
public
void
DefaultSize_IsReasonable
()
171
{
172
var btn =
new
DreamineButton();
173
Assert.True(btn.Width > 0 && btn.Height > 0);
174
}
175
192
private
sealed
class
RelayTestCommand
(Action<object?> execute) : ICommand
193
{
202
event
EventHandler? ICommand.CanExecuteChanged { add { }
remove
{ } }
227
public
bool
CanExecute
(
object
? p) =>
true
;
244
public
void
Execute
(
object
? p) => execute(p);
245
}
246
}
Dreamine.UI.WinForms.Tests.Controls
Definition
DreamineButtonTests.cs:6
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests
Definition
DreamineButtonTests.cs:17
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.DefaultSize_IsReasonable
void DefaultSize_IsReasonable()
Definition
DreamineButtonTests.cs:170
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.Content_SetAndGet_Roundtrip
void Content_SetAndGet_Roundtrip()
Definition
DreamineButtonTests.cs:42
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.CommandParameter_SetAndGet_Roundtrip
void CommandParameter_SetAndGet_Roundtrip()
Definition
DreamineButtonTests.cs:154
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.Command_Execute_InvokesAction
void Command_Execute_InvokesAction()
Definition
DreamineButtonTests.cs:134
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.IsSelected_ToggleWorks
void IsSelected_ToggleWorks()
Definition
DreamineButtonTests.cs:102
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.DefaultContent_IsEmpty
void DefaultContent_IsEmpty()
Definition
DreamineButtonTests.cs:27
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.ShineColor_SetAndGet_Roundtrip
void ShineColor_SetAndGet_Roundtrip()
Definition
DreamineButtonTests.cs:72
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.IsSelected_DefaultIsFalse
void IsSelected_DefaultIsFalse()
Definition
DreamineButtonTests.cs:87
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.ShineColor_DefaultIsEmpty
void ShineColor_DefaultIsEmpty()
Definition
DreamineButtonTests.cs:57
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.CornerRadius_DefaultIsPositive
void CornerRadius_DefaultIsPositive()
Definition
DreamineButtonTests.cs:119
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.RelayTestCommand
Definition
DreamineButtonTests.cs:193
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.RelayTestCommand.Execute
void Execute(object? p)
Definition
DreamineButtonTests.cs:244
Dreamine.UI.WinForms.Tests.Controls.DreamineButtonTests.RelayTestCommand.CanExecute
bool CanExecute(object? p)
Definition
DreamineButtonTests.cs:227
Controls
DreamineButtonTests.cs
다음에 의해 생성됨 :
1.17.0