Dreamine.UI.WinForms.Tests
1.0.0.0
Dreamine.UI.WinForms.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DreamineCheckBoxTests.cs
이 파일의 문서화 페이지로 가기
1
using
System.Runtime.ExceptionServices;
2
using
Dreamine.UI.WinForms.Controls;
3
using
Xunit;
4
5
namespace
Dreamine.UI.WinForms.Tests.Controls
;
6
15
public
class
DreamineCheckBoxTests
16
{
33
private
static
void
Sta
(Action action)
34
{
35
Exception? ex =
null
;
36
var t =
new
Thread(() => {
try
{ action(); }
catch
(Exception e) { ex = e; } });
37
t.SetApartmentState(ApartmentState.STA);
38
t.Start();
39
t.Join();
40
if
(ex is not
null
) ExceptionDispatchInfo.Capture(ex).Throw();
41
}
42
51
[Fact]
52
public
void
IsChecked_DefaultIsFalse
()
53
=>
Sta
(() =>
54
{
55
var cb =
new
DreamineCheckBox();
56
Assert.False(cb.IsChecked);
57
});
58
67
[Fact]
68
public
void
IsChecked_SetToTrue_PropertyChanges
()
69
=>
Sta
(() =>
70
{
71
var cb =
new
DreamineCheckBox {
IsChecked
=
true
};
72
Assert.True(cb.IsChecked);
73
});
74
83
[Fact]
84
public
void
IsChecked_Toggle_RaisesCheckedChanged
()
85
=>
Sta
(() =>
86
{
87
var cb =
new
DreamineCheckBox();
88
int
fired
= 0;
89
cb.CheckedChanged += (_, _) =>
fired
++;
90
cb.IsChecked =
true
;
91
cb.IsChecked =
false
;
92
Assert.Equal(2,
fired
);
93
});
94
103
[Fact]
104
public
void
IsChecked_SameValue_DoesNotRaiseEvent
()
105
=>
Sta
(() =>
106
{
107
var cb =
new
DreamineCheckBox {
IsChecked
=
false
};
108
int
fired
= 0;
109
cb.CheckedChanged += (_, _) =>
fired
++;
110
cb.IsChecked =
false
;
111
Assert.Equal(0,
fired
);
112
});
113
122
[Fact]
123
public
void
Content_SetAndGet_Roundtrip
()
124
=>
Sta
(() =>
125
{
126
var cb =
new
DreamineCheckBox { Content =
"Accept terms"
};
127
Assert.Equal(
"Accept terms"
, cb.Content);
128
});
129
}
Dreamine.UI.WinForms.Tests.Controls
Definition
DreamineButtonTests.cs:6
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests
Definition
DreamineCheckBoxTests.cs:16
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.IsChecked_SetToTrue_PropertyChanges
void IsChecked_SetToTrue_PropertyChanges()
Definition
DreamineCheckBoxTests.cs:68
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.Content_SetAndGet_Roundtrip
void Content_SetAndGet_Roundtrip()
Definition
DreamineCheckBoxTests.cs:123
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.IsChecked_DefaultIsFalse
void IsChecked_DefaultIsFalse()
Definition
DreamineCheckBoxTests.cs:52
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.fired
int fired
Definition
DreamineCheckBoxTests.cs:88
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.IsChecked_Toggle_RaisesCheckedChanged
void IsChecked_Toggle_RaisesCheckedChanged()
Definition
DreamineCheckBoxTests.cs:84
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.Sta
static void Sta(Action action)
Definition
DreamineCheckBoxTests.cs:33
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.IsChecked
cb. IsChecked
Definition
DreamineCheckBoxTests.cs:90
Dreamine.UI.WinForms.Tests.Controls.DreamineCheckBoxTests.IsChecked_SameValue_DoesNotRaiseEvent
void IsChecked_SameValue_DoesNotRaiseEvent()
Definition
DreamineCheckBoxTests.cs:104
Controls
DreamineCheckBoxTests.cs
다음에 의해 생성됨 :
1.17.0