Dreamine.UI.WinForms.Tests 1.0.0.0
Dreamine.UI.WinForms.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
DreamineCheckBoxTests.cs
이 파일의 문서화 페이지로 가기
1using System.Runtime.ExceptionServices;
2using Dreamine.UI.WinForms.Controls;
3using Xunit;
4
6
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]
53 => Sta(() =>
54 {
55 var cb = new DreamineCheckBox();
56 Assert.False(cb.IsChecked);
57 });
58
67 [Fact]
69 => Sta(() =>
70 {
71 var cb = new DreamineCheckBox { IsChecked = true };
72 Assert.True(cb.IsChecked);
73 });
74
83 [Fact]
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]
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]
124 => Sta(() =>
125 {
126 var cb = new DreamineCheckBox { Content = "Accept terms" };
127 Assert.Equal("Accept terms", cb.Content);
128 });
129}