Dreamine.FullKit.Wpf.Tests
1.0.0.0
Dreamine.FullKit.Wpf.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
LoggingWpfTests.cs
이 파일의 문서화 페이지로 가기
1
using
Dreamine.Logging.Interfaces;
2
using
Dreamine.Logging.Models;
3
using
Dreamine.Logging.Services;
4
using
Dreamine.Logging.Wpf.Services;
5
using
Dreamine.Logging.Wpf.ViewModels;
6
using
System.Windows.Threading;
7
8
namespace
Dreamine.FullKit.Wpf.Tests.Logging
;
9
18
public
sealed
class
LoggingWpfTests
19
{
28
[Fact]
29
public
void
LogPanelViewModel_SeedsExistingEntriesAndUpdatesSelectionDetail
()
30
{
31
var store =
new
InMemoryLogStore();
32
var first =
Entry
(
"first"
);
33
var second =
Entry
(
"second"
);
34
store.Add(first);
35
store.Add(second);
36
37
using
var viewModel =
new
DreamineLogPanelViewModel(
38
store,
39
new
WpfLogUiDispatcher(),
40
displayCapacity: 1);
41
42
viewModel.SelectedEntry = second;
43
44
Assert.Single(viewModel.Entries);
45
Assert.Same(second, viewModel.Entries[0]);
46
Assert.Contains(
"second"
, viewModel.SelectedDetailText);
47
}
48
57
[Fact]
58
public
void
LogPanelViewModel_ClearClearsUnderlyingStoreImmediately
()
59
{
60
var store =
new
InMemoryLogStore();
61
store.Add(
Entry
(
"message"
));
62
63
using
var viewModel =
new
DreamineLogPanelViewModel(store,
new
WpfLogUiDispatcher());
64
65
viewModel.Clear();
66
67
Assert.Empty(store.GetEntries());
68
}
69
78
[Fact]
79
public
void
LogPanelViewModel_AcceptsDispatcherAbstraction
()
80
{
81
var store =
new
InMemoryLogStore();
82
83
using
var viewModel =
new
DreamineLogPanelViewModel(
84
store,
85
new
TestLogUiDispatcher
());
86
87
Assert.Empty(viewModel.Entries);
88
}
89
114
private
static
DreamineLogEntry
Entry
(
string
message)
115
{
116
return
new
DreamineLogEntry(
117
DateTimeOffset.UnixEpoch,
118
DreamineLogLevel.Info,
119
"Test"
,
120
message,
121
exception:
null
,
122
threadId: 1);
123
}
124
133
private
sealed
class
TestLogUiDispatcher
: ILogUiDispatcher
134
{
143
public
Dispatcher
Dispatcher
{
get
; } =
Dispatcher
.CurrentDispatcher;
144
161
public
void
Invoke
(Action action)
162
{
163
action();
164
}
165
182
public
void
BeginInvoke
(Action action)
183
{
184
action();
185
}
186
}
187
}
Dreamine.FullKit.Wpf.Tests.Logging
Definition
LoggingWpfTests.cs:8
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests
Definition
LoggingWpfTests.cs:19
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.LogPanelViewModel_ClearClearsUnderlyingStoreImmediately
void LogPanelViewModel_ClearClearsUnderlyingStoreImmediately()
Definition
LoggingWpfTests.cs:58
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.LogPanelViewModel_SeedsExistingEntriesAndUpdatesSelectionDetail
void LogPanelViewModel_SeedsExistingEntriesAndUpdatesSelectionDetail()
Definition
LoggingWpfTests.cs:29
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.LogPanelViewModel_AcceptsDispatcherAbstraction
void LogPanelViewModel_AcceptsDispatcherAbstraction()
Definition
LoggingWpfTests.cs:79
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.Entry
static DreamineLogEntry Entry(string message)
Definition
LoggingWpfTests.cs:114
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.TestLogUiDispatcher
Definition
LoggingWpfTests.cs:134
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.TestLogUiDispatcher.BeginInvoke
void BeginInvoke(Action action)
Definition
LoggingWpfTests.cs:182
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.TestLogUiDispatcher.Dispatcher
Dispatcher Dispatcher
Definition
LoggingWpfTests.cs:143
Dreamine.FullKit.Wpf.Tests.Logging.LoggingWpfTests.TestLogUiDispatcher.Invoke
void Invoke(Action action)
Definition
LoggingWpfTests.cs:161
Logging
LoggingWpfTests.cs
다음에 의해 생성됨 :
1.17.0