1 write to Message
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogRecord.cs (1)
36
Message
= Throw.IfNull(message);
204 references to Message
Aspire.Hosting.Containers.Tests (1)
WithDockerfileTests.cs (1)
82
Assert.Contains(logs, log => log.
Message
.Contains("load build definition from Dockerfile"));
Aspire.Hosting.Testing.Tests (6)
ResourceLoggerForwarderServiceTests.cs (6)
119
log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("1: 2000-12-29T20:59:59.0000000Z Test trace message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); },
120
log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("2: 2000-12-29T20:59:59.0000000Z Test debug message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); },
121
log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("3: 2000-12-29T20:59:59.0000000Z Test information message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); },
122
log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("4: 2000-12-29T20:59:59.0000000Z Test warning message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); },
123
log => { Assert.Equal(LogLevel.Error, log.Level); Assert.Equal("5: 2000-12-29T20:59:59.0000000Z Test error message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); },
124
log => { Assert.Equal(LogLevel.Error, log.Level); Assert.Equal("6: 2000-12-29T20:59:59.0000000Z Test critical message", log.
Message
); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); });
Aspire.Hosting.Tests (14)
Codespaces\CodespacesUrlRewriterTests.cs (1)
44
urlRewriterStopped = logs.Any(l => l.
Message
.Contains("Not running in Codespaces, skipping URL rewriting."));
HealthCheckTests.cs (1)
129
l => l.
Message
== "The health check 'test_check' is not registered and is required for resource 'test'."
ResourceNotificationTests.cs (12)
308
Assert.Contains(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state: SomeState"));
318
Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state: SomeState"));
328
Assert.Contains(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state: SomeState -> NewState"));
338
Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state:"));
348
Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state:"));
358
Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.
Message
.Contains("Resource resource1/resource1 changed state:"));
379
Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.
Message
.Contains("Resource resource1/resource1 update published:") && l.
Message
.Contains($"CreationTimeStamp = {createdDate:s}"));
380
Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.
Message
.Contains("Resource resource1/resource1 update published:") && l.
Message
.Contains("State = { Text = SomeState"));
381
Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.
Message
.Contains("Resource resource1/resource1 update published:") && l.
Message
.Contains("ExitCode = 0"));
Microsoft.AspNetCore.HeaderParsing.Tests (3)
HeaderParsingFeatureTests.cs (3)
111
Assert.Equal("Header 'Date' not found.", _logger.Collector.LatestRecord.
Message
);
130
Assert.Equal("Using a default value for header 'Date'.", _logger.Collector.LatestRecord.
Message
);
148
Assert.Equal("Can't parse header 'Date' due to 'Unable to parse date time offset value.'.", _logger.Collector.LatestRecord.
Message
);
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (1)
TelemetryHealthChecksPublisherTests.cs (1)
105
Assert.Equal(expectedLogMessage, collector.LatestRecord.
Message
);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (3)
ResourceMonitoringServiceTests.cs (2)
264
Assert.Contains(ProviderUnableToGatherData, logger.Collector.LatestRecord.
Message
, StringComparison.OrdinalIgnoreCase);
292
Assert.Contains(_publisherUnableToPublishErrorMessage, logger.Collector.LatestRecord.
Message
, StringComparison.OrdinalIgnoreCase);
Windows\WindowsSnapshotProviderTests.cs (1)
69
Assert.StartsWith("System resources information", logRecords[1].
Message
);
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogRecord.cs (1)
148
return $"[{record.Timestamp:mm:ss.fff}, {level}] {record.
Message
}";
Microsoft.Extensions.Diagnostics.Testing.Tests (6)
Logging\FakeLoggerTests.cs (6)
36
Assert.Equal("Hello", records[0].
Message
);
45
Assert.Equal("World", records[1].
Message
);
53
Assert.Equal("World", logger.LatestRecord.
Message
);
196
Assert.Equal("BEFORE", logger.LatestRecord.
Message
);
218
Assert.Equal("M4", logger.LatestRecord.
Message
);
242
Assert.Equal("M2", logger.LatestRecord.
Message
);
Microsoft.Extensions.Hosting.Testing.Tests (2)
HostTerminatorServiceTests.cs (2)
48
logger.LatestRecord.
Message
);
64
logger.LatestRecord.
Message
);
Microsoft.Extensions.Http.Diagnostics.Tests (6)
Logging\AcceptanceTests.cs (5)
47
Assert.Equal($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.
Message
);
79
Assert.StartsWith($"An error occurred in enricher '{typeof(TestEnricher).FullName}'", firstLogRecord.
Message
);
80
Assert.EndsWith($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", firstLogRecord.
Message
);
88
Assert.Equal($"{HttpMethod.Get} {_unreachableRequestUri.Host}/{TelemetryConstants.Redacted}", secondLogRecord.
Message
);
117
Assert.Equal($"{httpRequestMessage.Method} {httpRequestMessage.RequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.
Message
);
Logging\HttpClientLoggerTest.cs (1)
441
Assert.Equal($"{httpRequestMessage.Method} {httpRequestMessage.RequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.
Message
);
Microsoft.Extensions.Telemetry.Tests (14)
Logging\ExtendedLoggerTests.cs (14)
80
Assert.Equal("MSG0", snap[0].
Message
);
96
Assert.Equal("MSG2", snap[1].
Message
);
165
Assert.Equal("MSG0", snap[0].
Message
);
172
Assert.Equal("MSG2", snap[1].
Message
);
230
Assert.Equal("MSG0", snap[0].
Message
);
237
Assert.Equal("MSG0b", snap[1].
Message
);
244
Assert.Equal("MSG2", snap[2].
Message
);
251
Assert.Equal("MSG2b", snap[3].
Message
);
290
Assert.Equal("MSG0", snap[0].
Message
);
359
Assert.Equal("MSG0", snap[0].
Message
);
468
Assert.Equal("MSG0", snap[0].
Message
);
473
Assert.Equal("MSG0b", snap[1].
Message
);
478
Assert.Equal("MSG2", snap[2].
Message
);
483
Assert.Equal("MSG2b", snap[3].
Message
);
Microsoft.Gen.Logging.Generated.Tests (147)
DataClassificationTests.cs (1)
23
Assert.Equal("M2", collector.LatestRecord.
Message
);
LoggerFromMemberTests.cs (12)
25
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
42
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
63
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
80
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
101
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
115
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
131
Assert.Equal("M1 arg0", logger.Collector.LatestRecord.
Message
);
141
Assert.Equal("M1 arg1", logger.Collector.LatestRecord.
Message
);
144
Assert.Equal("M0 arg1", logger2.Collector.LatestRecord.
Message
);
158
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
175
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
180
Assert.Equal("M1 arg0", collector.LatestRecord.
Message
);
LoggerMessageAttributeTests.cs (13)
22
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
35
Assert.Equal("M0 arg0", collector.LatestRecord.
Message
);
48
Assert.Equal("M1 ---- arg1", collector.LatestRecord.
Message
);
54
Assert.Equal("M2 ---- arg1", collector.LatestRecord.
Message
);
67
Assert.Equal("M8 ------", collector.LatestRecord.
Message
);
73
Assert.Equal("M9 ----", collector.LatestRecord.
Message
);
79
Assert.Equal("M10 ------------------------", collector.LatestRecord.
Message
);
92
Assert.Equal("M3 ---- ---- ---- ----", collector.LatestRecord.
Message
);
98
Assert.Equal("M4 ---- ---- ---- ------------------------", collector.LatestRecord.
Message
);
111
Assert.Equal("M5 ---- ---- ---- ---- ---- ---- ---- ---- ++++ ++++ +++++", collector.LatestRecord.
Message
);
139
Assert.Equal("M1 ----", collector.LatestRecord.
Message
);
145
Assert.Equal("M2 ---- ---- ----", collector.LatestRecord.
Message
);
157
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
LogMethodTests.cs (76)
27
Assert.Equal("Could not open socket to `microsoft.com`", collector.LatestRecord.
Message
);
34
Assert.Equal("Could not open socket to `microsoft.com`", collector.LatestRecord.
Message
);
41
Assert.Equal("Could not open socket to `microsoft.com`", collector.LatestRecord.
Message
);
54
Assert.Equal("Could not open socket to `microsoft.com`", collector.LatestRecord.
Message
);
90
Assert.Equal("Hello World", collector.LatestRecord.
Message
);
98
Assert.Equal("Hello World", collector.LatestRecord.
Message
);
113
Assert.Equal("M1", collector.LatestRecord.
Message
);
119
Assert.Equal("M2 arg1", collector.LatestRecord.
Message
);
125
Assert.Equal("M3 arg1 2", collector.LatestRecord.
Message
);
131
Assert.Equal("M4", collector.LatestRecord.
Message
);
137
Assert.Equal("M5 System.InvalidOperationException: B", collector.LatestRecord.
Message
);
143
Assert.Equal("M6 2", collector.LatestRecord.
Message
);
149
Assert.Equal("M7 1", collector.LatestRecord.
Message
);
154
Assert.Equal("M81234567", collector.LatestRecord.
Message
);
159
Assert.Equal("M9 1 2 3 4 5 6 7", collector.LatestRecord.
Message
);
164
Assert.Equal("M101", collector.LatestRecord.
Message
);
224
Assert.Equal("M0 Zero", collector.LatestRecord.
Message
);
232
Assert.Equal("M1 One", collector.LatestRecord.
Message
);
240
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
248
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
256
Assert.Equal("M4 Four", collector.LatestRecord.
Message
);
264
Assert.Equal("M5 Five", collector.LatestRecord.
Message
);
272
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
283
Assert.Equal(string.Empty, logRecord.
Message
);
294
Assert.Equal("M8", logRecord.
Message
);
309
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
316
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
323
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
330
Assert.Equal("\"Hello\" World", collector.LatestRecord.
Message
);
337
Assert.Equal("\"p\" -> \"q\"", collector.LatestRecord.
Message
);
345
Assert.Equal("\"\n\r\\", collector.LatestRecord.
Message
);
362
Assert.Equal("M0", collector.LatestRecord.
Message
);
369
Assert.Equal("M1 Foo", collector.LatestRecord.
Message
);
379
Assert.Equal(string.Empty, logRecord.
Message
);
404
Assert.Equal("M2", collector.LatestRecord.
Message
);
411
Assert.Equal("M3", collector.LatestRecord.
Message
);
418
Assert.Equal("M4", collector.LatestRecord.
Message
);
425
Assert.Equal("M5", collector.LatestRecord.
Message
);
432
Assert.Equal("M6", collector.LatestRecord.
Message
);
439
Assert.Equal("M7", collector.LatestRecord.
Message
);
446
Assert.Equal("M8", collector.LatestRecord.
Message
);
453
Assert.Equal("M9", collector.LatestRecord.
Message
);
460
Assert.Equal("M10 Warning", collector.LatestRecord.
Message
);
482
Assert.Equal("No params here...", collector.LatestRecord.
Message
);
489
Assert.Equal("No params here as well...", collector.LatestRecord.
Message
);
496
Assert.Equal("No params here as well...", collector.LatestRecord.
Message
);
510
Assert.Equal("M2 --- --- -----", collector.LatestRecord.
Message
);
527
Assert.Equal("M0 System.ArgumentException: Bar", collector.LatestRecord.
Message
);
534
Assert.Equal("M1 System.ArgumentException: Bar", collector.LatestRecord.
Message
);
541
Assert.Equal("M2 One: System.ArgumentException: Foo", collector.LatestRecord.
Message
);
552
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
565
Assert.Equal("M0", collector.LatestRecord.
Message
);
576
Assert.Equal(string.Empty, logRecord.
Message
);
591
Assert.Equal("M8", collector.LatestRecord.
Message
);
598
Assert.Equal("M9", collector.LatestRecord.
Message
);
605
Assert.Equal("M10", collector.LatestRecord.
Message
);
612
Assert.Equal("M11", collector.LatestRecord.
Message
);
619
Assert.Equal("M12", collector.LatestRecord.
Message
);
633
Assert.Equal("M0 0", collector.LatestRecord.
Message
);
641
Assert.Equal("M1 42 42", collector.LatestRecord.
Message
);
649
Assert.Equal("M2 42 43 44 45 46 47 48", collector.LatestRecord.
Message
);
663
Assert.Equal("M3 43 42", collector.LatestRecord.
Message
);
679
Assert.Equal("M0", collector.LatestRecord.
Message
);
693
Assert.Equal("M0", collector.LatestRecord.
Message
);
728
Assert.Contains("Hello from S", collector.LatestRecord.
Message
);
739
Assert.Equal("M0 Test", record.
Message
);
756
Assert.Equal("UseAtSymbol3, 42 42", collector.LatestRecord.
Message
);
762
Assert.Equal("UseAtSymbol4 with error, 42 42", collector.LatestRecord.
Message
);
776
Assert.Equal("M6 class 42", collector.LatestRecord.
Message
);
781
Assert.Equal("M7 param 42", collector.LatestRecord.
Message
);
802
Assert.Equal("M0 (null)", collector.LatestRecord.
Message
);
805
Assert.Equal("M1 (null)", collector.LatestRecord.
Message
);
808
Assert.Equal("M3 (null)", collector.LatestRecord.
Message
);
811
Assert.Equal("M4 (null) (null) (null) (null) (null) (null) (null) (null) (null)", collector.LatestRecord.
Message
);
814
Assert.Equal("M5 (null) (null) (null) (null) (null) (null) (null) (null) (null)", collector.LatestRecord.
Message
);
834
Assert.Equal("M0 " + dt.ToString(CultureInfo.InvariantCulture), collector.LatestRecord.
Message
);
LogPropertiesRedactionTests.cs (6)
31
Assert.Equal("LogProperties with redaction: ----", collector.LatestRecord.
Message
);
57
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
80
Assert.Equal("No template params", collector.LatestRecord.
Message
);
111
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
140
Assert.Equal("Only ----------- as param", collector.LatestRecord.
Message
);
166
Assert.Equal(string.Empty, collector.LatestRecord.
Message
);
LogPropertiesTests.cs (12)
303
Assert.Equal($"Both {StringProperty} and {classToLog} as params", _logger.Collector.LatestRecord.
Message
);
324
Assert.Equal($"Testing nullable property within class here...", _logger.Collector.LatestRecord.
Message
);
344
Assert.Equal($"Testing nullable property within class here...", _logger.Collector.LatestRecord.
Message
);
366
Assert.Equal($"LogProperties: {StringParamValue}", latestRecord.
Message
);
390
Assert.Equal("Testing non-nullable struct here...", latestRecord.
Message
);
420
Assert.Equal("Testing nullable struct here...", latestRecord.
Message
);
449
Assert.Equal("Testing explicit nullable struct here...", latestRecord.
Message
);
475
Assert.Equal(string.Empty, latestRecord.
Message
);
502
Assert.Equal("Testing interface-typed argument here...", latestRecord.
Message
);
526
Assert.Empty(latestRecord.
Message
);
551
Assert.Equal($"Struct is: {recordToLog}", latestRecord.
Message
);
577
Assert.Equal($"Readonly struct is: {recordToLog}", latestRecord.
Message
);
PrimaryConstructorTests.cs (4)
24
Assert.Equal("Test.", collector.LatestRecord.
Message
);
38
Assert.Equal("Test.", collector.LatestRecord.
Message
);
52
Assert.Equal("Test.", collector.LatestRecord.
Message
);
66
Assert.Equal("Test.", collector.LatestRecord.
Message
);
SensitiveRecordTests.cs (5)
20
Assert.DoesNotContain(SensitiveRecordExtensions.Sensitive, logRecord.
Message
);
32
Assert.DoesNotContain(SensitiveRecordExtensions.Sensitive, logRecord.
Message
);
49
Assert.DoesNotContain(SensitiveRecordExtensions.Sensitive, logRecord.
Message
);
66
Assert.DoesNotContain(SensitiveRecordExtensions.Sensitive, logRecord.
Message
);
83
Assert.DoesNotContain(SensitiveRecordExtensions.Sensitive, logRecord.
Message
);
TagNameTests.cs (1)
33
Assert.Equal("0", logger.Collector.LatestRecord.
Message
);
TagProviderTests.cs (17)
35
Assert.Equal($"Custom provided properties for {obj}.", latestRecord.
Message
);
58
Assert.Equal($"LogProperties with provider: {StringParamValue}, {classToLog}", latestRecord.
Message
);
85
Assert.Equal(string.Empty, latestRecord.
Message
);
108
Assert.Equal(string.Empty, latestRecord.
Message
);
129
Assert.Equal(string.Empty, latestRecord.
Message
);
140
Assert.Equal(string.Empty, latestRecord.
Message
);
164
Assert.Equal(string.Empty, latestRecord.
Message
);
190
Assert.Equal(string.Empty, latestRecord.
Message
);
209
Assert.Equal("Custom provided properties for (null).", latestRecord.
Message
);
228
Assert.Equal("Custom provided properties for (null).", latestRecord.
Message
);
248
Assert.Equal($"Custom provided properties for {classToLog}.", latestRecord.
Message
);
270
Assert.Equal($"Custom provided properties for struct.", latestRecord.
Message
);
291
Assert.Equal($"Custom provided properties for interface.", latestRecord.
Message
);
332
Assert.Equal("No params.", latestRecord.
Message
);
359
Assert.Equal($"Custom provided properties for both complex params and {StringParamValue}.", latestRecord.
Message
);
397
Assert.Equal($"Custom provided properties for both complex params and {StringParamValue}.", latestRecord.
Message
);
422
Assert.Equal($"Custom provided properties for both complex params and {StringParamValue}.", latestRecord.
Message
);