Skip to content

Commit 4999405

Browse files
(#140) Test implicit default values
1 parent 388963c commit 4999405

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[
2+
{
3+
Sequence: 0,
4+
LogLevel: Information,
5+
CategoryName: Stravaig.Extensions.Logging.Diagnostics.Tests.Verify.VerifyDefaultSettingsTests,
6+
FormattedMessage: This is the first default log message
7+
},
8+
{
9+
Sequence: 1,
10+
LogLevel: Warning,
11+
CategoryName: Stravaig.Extensions.Logging.Diagnostics.Tests.Verify.VerifyDefaultSettingsTests,
12+
FormattedMessage: This is a warning
13+
},
14+
{
15+
Sequence: 2,
16+
LogLevel: Error,
17+
CategoryName: Stravaig.Extensions.Logging.Diagnostics.Tests.Verify.VerifyDefaultSettingsTests,
18+
FormattedMessage: An exception was thrown. See the exception for details.,
19+
Exception: {
20+
Message: I'm a fake exception to be put in the log.,
21+
Type: System.ApplicationException
22+
}
23+
},
24+
{
25+
Sequence: 3,
26+
LogLevel: Critical,
27+
CategoryName: Stravaig.Extensions.Logging.Diagnostics.Tests.Verify.VerifyDefaultSettingsTests,
28+
FormattedMessage: An exception was thrown, which caused another exception to be thrown.,
29+
Exception: {
30+
Message: An application exception happened,
31+
Type: System.ApplicationException,
32+
InnerException: {
33+
Message: An invalid operation happened.,
34+
Type: System.InvalidOperationException
35+
}
36+
}
37+
}
38+
]

src/Stravaig.Extensions.Logging.Diagnostics.Tests/Verify/VerifyDefaultSettingsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public async Task TestExplicitDefaultAsync()
2121
await Verifier.Verify(logs, settings);
2222
}
2323

24+
[Test]
2425
public async Task TestImplicitDefaultAwait()
2526
{
2627
// The settings are added as part of the module initialiser

src/Stravaig.Extensions.Logging.Diagnostics.Verify/LogEntryConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ internal class LogEntryConverter : WriteOnlyJsonConverter<IEnumerable<LogEntry>>
88
{
99
private readonly Settings _settings;
1010

11-
public LogEntryConverter() : this(Settings.Default)
11+
public LogEntryConverter()
12+
: this(Settings.Default)
1213
{
1314

1415
}

src/Stravaig.Extensions.Logging.Diagnostics.Verify/VerifyStravaigLoggingCapture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public static void Initialise()
2121

2222
private static void LogEntrySettings(JsonSerializerSettings settings)
2323
{
24-
settings.Converters.Add(new LogEntryConverter());
24+
var defaultLogEntryConverter = new LogEntryConverter();
25+
settings.Converters.Add(defaultLogEntryConverter);
2526
}
2627

2728
private static void ThrowIfInitialised()

0 commit comments

Comments
 (0)