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