@@ -16,18 +16,19 @@ public class ConfigurationReaderTests
16
16
public ConfigurationReaderTests()
17
17
{
18
18
_configurationReader = new ConfigurationReader(
19
- JsonStringConfigSource.LoadSection(@ "{ 'Serilog': { } }", "Serilog"),
19
+ JsonStringConfigSource.LoadSection("{ 'Serilog': { } }", "Serilog"),
20
20
AssemblyFinder.ForSource(ConfigurationAssemblySource.UseLoadedAssemblies),
21
21
CultureInfo.InvariantCulture);
22
22
}
23
23
24
24
[Fact]
25
25
public void WriteToSupportSimplifiedSyntax()
26
26
{
27
- var json = @"
28
- {
29
- 'WriteTo': [ 'LiterateConsole', 'DiagnosticTrace' ]
30
- }";
27
+ var json = """
28
+ {
29
+ 'WriteTo': [ 'LiterateConsole', 'DiagnosticTrace' ]
30
+ }
31
+ """;
31
32
32
33
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
33
34
Assert.Equal(2, result.Count);
@@ -41,12 +42,13 @@ public void WriteToSupportSimplifiedSyntax()
41
42
[Fact]
42
43
public void WriteToSupportExpandedSyntaxWithoutArgs()
43
44
{
44
- var json = @"
45
- {
46
- 'WriteTo': [ {
47
- 'Name': 'LiterateConsole'
48
- }]
49
- }";
45
+ var json = """
46
+ {
47
+ 'WriteTo': [ {
48
+ 'Name': 'LiterateConsole'
49
+ }]
50
+ }
51
+ """;
50
52
51
53
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
52
54
Assert.Equal(1, result.Count);
@@ -58,15 +60,16 @@ public void WriteToSupportExpandedSyntaxWithoutArgs()
58
60
[Fact]
59
61
public void WriteToSupportExpandedSyntaxWithArgs()
60
62
{
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
+ """;
70
73
71
74
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
72
75
@@ -85,30 +88,31 @@ public void WriteToSupportExpandedSyntaxWithArgs()
85
88
[Fact]
86
89
public void WriteToSupportMultipleSinksOfTheSameKind()
87
90
{
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
+ """;
112
116
113
117
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));
114
118
@@ -125,10 +129,11 @@ public void WriteToSupportMultipleSinksOfTheSameKind()
125
129
[Fact]
126
130
public void Enrich_SupportSimplifiedSyntax()
127
131
{
128
- var json = @"
129
- {
130
- 'Enrich': [ 'FromLogContext', 'WithMachineName', 'WithThreadId' ]
131
- }";
132
+ var json = """
133
+ {
134
+ 'Enrich': [ 'FromLogContext', 'WithMachineName', 'WithThreadId' ]
135
+ }
136
+ """;
132
137
133
138
var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "Enrich"));
134
139
Assert.Equal(3, result.Count);
@@ -269,7 +274,7 @@ public void MixedMinimumLevelCorrectOneIsEnabledOnLogger(IConfigurationRoot root
269
274
[Fact]
270
275
public void NoConfigurationRootUsedStillValid()
271
276
{
272
- var section = JsonStringConfigSource.LoadSection(@ "{ 'Nest': { 'Serilog': { 'MinimumLevel': 'Error' } } }", "Nest");
277
+ var section = JsonStringConfigSource.LoadSection("{ 'Nest': { 'Serilog': { 'MinimumLevel': 'Error' } } }", "Nest");
273
278
var reader = new ConfigurationReader(section.GetSection("Serilog"), AssemblyFinder.ForSource(ConfigurationAssemblySource.UseLoadedAssemblies), CultureInfo.InvariantCulture, section);
274
279
var loggerConfig = new LoggerConfiguration();
275
280
0 commit comments