Skip to content

Commit 2321e72

Browse files
authored
Merge branch 'dev' into LogLevelSwitches
2 parents d7bde06 + 0a29ea3 commit 2321e72

File tree

5 files changed

+599
-494
lines changed

5 files changed

+599
-494
lines changed

test/Serilog.Settings.Configuration.Tests/ConfigurationReaderTests.cs

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ public class ConfigurationReaderTests
1616
public ConfigurationReaderTests()
1717
{
1818
_configurationReader = new ConfigurationReader(
19-
JsonStringConfigSource.LoadSection(@"{ 'Serilog': { } }", "Serilog"),
19+
JsonStringConfigSource.LoadSection("{ 'Serilog': { } }", "Serilog"),
2020
AssemblyFinder.ForSource(ConfigurationAssemblySource.UseLoadedAssemblies),
2121
new ConfigurationReaderOptions());
2222
}
2323

2424
[Fact]
2525
public void WriteToSupportSimplifiedSyntax()
2626
{
27-
var json = @"
28-
{
29-
'WriteTo': [ 'LiterateConsole', 'DiagnosticTrace' ]
30-
}";
27+
var json = """
28+
{
29+
'WriteTo': [ 'LiterateConsole', 'DiagnosticTrace' ]
30+
}
31+
""";
3132

3233
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
3334
Assert.Equal(2, result.Count);
@@ -41,12 +42,13 @@ public void WriteToSupportSimplifiedSyntax()
4142
[Fact]
4243
public void WriteToSupportExpandedSyntaxWithoutArgs()
4344
{
44-
var json = @"
45-
{
46-
'WriteTo': [ {
47-
'Name': 'LiterateConsole'
48-
}]
49-
}";
45+
var json = """
46+
{
47+
'WriteTo': [ {
48+
'Name': 'LiterateConsole'
49+
}]
50+
}
51+
""";
5052

5153
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
5254
Assert.Equal(1, result.Count);
@@ -58,15 +60,16 @@ public void WriteToSupportExpandedSyntaxWithoutArgs()
5860
[Fact]
5961
public void WriteToSupportExpandedSyntaxWithArgs()
6062
{
61-
var json = @"
62-
{
63-
'WriteTo': [ {
64-
'Name': 'LiterateConsole',
65-
'Args': {
66-
'outputTemplate': '{Message}'
67-
},
68-
}]
69-
}";
63+
var json = """
64+
{
65+
'WriteTo': [ {
66+
'Name': 'LiterateConsole',
67+
'Args': {
68+
'outputTemplate': '{Message}'
69+
},
70+
}]
71+
}
72+
""";
7073

7174
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
7275

@@ -85,30 +88,31 @@ public void WriteToSupportExpandedSyntaxWithArgs()
8588
[Fact]
8689
public void WriteToSupportMultipleSinksOfTheSameKind()
8790
{
88-
var json = @"
89-
{
90-
'WriteTo': [
91-
{
92-
'Name': 'LiterateConsole',
93-
'Args': {
94-
'outputTemplate': '{Message}'
95-
},
96-
},
97-
'DiagnosticTrace'
98-
],
99-
'WriteTo:File1': {
100-
'Name': 'File',
101-
'Args': {
102-
'outputTemplate': '{Message}'
103-
},
104-
},
105-
'WriteTo:File2': {
106-
'Name': 'File',
107-
'Args': {
108-
'outputTemplate': '{Message}'
109-
},
110-
}
111-
}";
91+
var json = """
92+
{
93+
'WriteTo': [
94+
{
95+
'Name': 'LiterateConsole',
96+
'Args': {
97+
'outputTemplate': '{Message}'
98+
},
99+
},
100+
'DiagnosticTrace'
101+
],
102+
'WriteTo:File1': {
103+
'Name': 'File',
104+
'Args': {
105+
'outputTemplate': '{Message}'
106+
},
107+
},
108+
'WriteTo:File2': {
109+
'Name': 'File',
110+
'Args': {
111+
'outputTemplate': '{Message}'
112+
},
113+
}
114+
}
115+
""";
112116

113117
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
114118

@@ -125,10 +129,11 @@ public void WriteToSupportMultipleSinksOfTheSameKind()
125129
[Fact]
126130
public void Enrich_SupportSimplifiedSyntax()
127131
{
128-
var json = @"
129-
{
130-
'Enrich': [ 'FromLogContext', 'WithMachineName', 'WithThreadId' ]
131-
}";
132+
var json = """
133+
{
134+
'Enrich': [ 'FromLogContext', 'WithMachineName', 'WithThreadId' ]
135+
}
136+
""";
132137

133138
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "Enrich"));
134139
Assert.Equal(3, result.Count);
@@ -269,7 +274,7 @@ public void MixedMinimumLevelCorrectOneIsEnabledOnLogger(IConfigurationRoot root
269274
[Fact]
270275
public void NoConfigurationRootUsedStillValid()
271276
{
272-
var section = JsonStringConfigSource.LoadSection(@"{ 'Nest': { 'Serilog': { 'MinimumLevel': 'Error' } } }", "Nest");
277+
var section = JsonStringConfigSource.LoadSection("{ 'Nest': { 'Serilog': { 'MinimumLevel': 'Error' } } }", "Nest");
273278
var reader = new ConfigurationReader(section.GetSection("Serilog"), AssemblyFinder.ForSource(ConfigurationAssemblySource.UseLoadedAssemblies), new ConfigurationReaderOptions(), section);
274279
var loggerConfig = new LoggerConfiguration();
275280

0 commit comments

Comments
 (0)