2 instantiations of WriteContext
Microsoft.AspNetCore.InternalTesting (1)
Logging\TestLogger.cs (1)
49_sink.Write(new WriteContext()
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
src\Shared\SignalR\LogSinkProvider.cs (1)
36new WriteContext
221 references to WriteContext
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (2)
317var aspnetcorev2Log = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:")); 318var aspnetcoreHandlerLog = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:"));
IIS.Tests (3)
MaxRequestBodySizeTests.cs (2)
357var appErrorLog = Assert.Single(TestSink.Writes, w => w.LoggerName == "Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer" && w.LogLevel > LogLevel.Debug); 358var badRequestLog = Assert.Single(TestSink.Writes, w => w.LoggerName == "Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer" && w.EventId == new EventId(4, "ConnectionBadRequest"));
StrictTestServerTests.cs (1)
20if (TestSink.Writes.FirstOrDefault(w => w.LogLevel > LogLevel.Information) is WriteContext writeContext)
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (2)
317var aspnetcorev2Log = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:")); 318var aspnetcoreHandlerLog = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:"));
Interop.FunctionalTests (4)
Http3\Http3RequestTests.cs (4)
1054var badLogWrite = TestSink.Writes.FirstOrDefault(w => w.LogLevel == LogLevel.Critical); 1140var badLogWrite = TestSink.Writes.FirstOrDefault(w => w.LogLevel >= LogLevel.Critical); 1815var connectionAbortLog = logs.FirstOrDefault( 1914private async Task WaitForLogAsync(Func<IEnumerable<WriteContext>, bool> testLogs, string message)
Microsoft.AspNetCore.Components.Tests (2)
Lifetime\ComponentStatePersistenceManagerTest.cs (2)
204var log = Assert.Single(sink.Writes); 233var log = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (8)
JsonTranscodingServiceMethodProviderTests.cs (1)
117var write = testSink.Writes.Single(w =>
ServerStreamingServerCallHandlerTests.cs (3)
119var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "ErrorExecutingServiceMethod"); 161var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "RpcConnectionError"); 198var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "ErrorExecutingServiceMethod");
UnaryServerCallHandlerTests.cs (4)
869var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "RpcConnectionError"); 1056var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "ErrorExecutingServiceMethod"); 1086var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "ErrorExecutingServiceMethod"); 1626var exceptionWrite = TestSink.Writes.Single(w => w.EventId.Name == "RpcConnectionError");
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionDispatcherTests.cs (4)
1027bool ExpectedErrors(WriteContext writeContext) 1271bool ExpectedErrors(WriteContext writeContext) 1358bool ExpectedErrors(WriteContext writeContext) 2716bool ExpectedErrors(WriteContext writeContext)
Microsoft.AspNetCore.Http.Extensions.Tests (19)
RequestDelegateFactoryTests.cs (4)
1581var log = Assert.Single(logs); 1680var log = Assert.Single(TestSink.Writes); 1947var logMessage = Assert.Single(TestSink.Writes); 1980var logMessage = Assert.Single(TestSink.Writes);
RequestDelegateGenerator\CompileTimeCreationTests.cs (2)
562var log1 = logs.FirstOrDefault(); 570var log2 = logs.LastOrDefault();
RequestDelegateGenerator\RequestDelegateCreationTests.BindAsync.cs (1)
142var log = Assert.Single(TestSink.Writes);
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (3)
344var logMessage = Assert.Single(TestSink.Writes); 940var logMessage = Assert.Single(TestSink.Writes); 974var logMessage = Assert.Single(TestSink.Writes);
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBody.cs (1)
474var log = Assert.Single(logs);
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBodyOrService.cs (1)
131var log = Assert.Single(logs);
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (5)
401var logMessage = Assert.Single(TestSink.Writes); 450var logMessage = Assert.Single(TestSink.Writes); 491var logMessage = Assert.Single(TestSink.Writes); 529var logMessage = Assert.Single(TestSink.Writes); 609var logMessage = Assert.Single(TestSink.Writes);
RequestDelegateGenerator\RequestDelegateCreationTests.QueryParameters.cs (1)
67var log = Assert.Single(logs);
RequestDelegateGenerator\RuntimeCreationTests.ComplexFormBinding.cs (1)
181var log = Assert.Single(logs);
Microsoft.AspNetCore.Http.Tests (1)
ResponseCookiesTest.cs (1)
53var writeContext = Assert.Single(sink.Writes);
Microsoft.AspNetCore.HttpLogging.Tests (5)
HttpLoggingMiddlewareTests.cs (5)
1276Assert.True(TestSink.Writes.TryTake(out var contentTypeLog)); 1279Assert.True(TestSink.Writes.TryTake(out var requestLog)); 1295Assert.False(TestSink.Writes.TryTake(out var _)); 1944var requestLog = Assert.Single(filteredLogs, w => w.Message.Contains("Request:")); 1948var responseLog = Assert.Single(filteredLogs, w => w.Message.Contains("Response:"));
Microsoft.AspNetCore.HttpsPolicy.Tests (12)
HstsMiddlewareTests.cs (5)
213var message = logMessages.Single(); 268var message = logMessages.Single(); 323var message = logMessages.Single(); 370var message = logMessages.Single(); 416var message = logMessages.Single();
HttpsRedirectionMiddlewareTests.cs (7)
60var message = logMessages.Single(); 116var message = logMessages.Single(); 172var message = logMessages.Single(); 273var message = logMessages.First(); 361var message = logMessages.First(); 407var message = logMessages.First(); 451var message = logMessages.First();
Microsoft.AspNetCore.InternalTesting (13)
Logging\ITestSink.cs (4)
11event Action<WriteContext> MessageLogged; 15Func<WriteContext, bool> WriteEnabled { get; set; } 21IProducerConsumerCollection<WriteContext> Writes { get; set; } 23void Write(WriteContext context);
Logging\TestSink.cs (9)
12private ConcurrentQueue<WriteContext> _writes; 15Func<WriteContext, bool> writeEnabled = null, 22_writes = new ConcurrentQueue<WriteContext>(); 25public Func<WriteContext, bool> WriteEnabled { get; set; } 31public IProducerConsumerCollection<WriteContext> Writes { get => _writes; set => _writes = new ConcurrentQueue<WriteContext>(value); } 33public event Action<WriteContext> MessageLogged; 37public void Write(WriteContext context) 55public static bool EnableWithTypeName<T>(WriteContext context)
Microsoft.AspNetCore.InternalTesting.Tests (5)
LoggedTestXunitTests.cs (5)
73var message = Assert.Single(TestSink.Writes); 84var message = Assert.Single(TestSink.Writes); 97var message = Assert.Single(TestSink.Writes); 137WriteContext context = null; 160var message = Assert.Single(TestSink.Writes);
Microsoft.AspNetCore.Localization.Tests (2)
CookieRequestCultureProviderTest.cs (2)
223var write = Assert.Single(sink.Writes); 282var write = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Mvc.Core.Test (24)
Filters\DisableRequestSizeLimitFilterTest.cs (3)
67var write = Assert.Single(sink.Writes); 90var write = Assert.Single(sink.Writes); 111var write = Assert.Single(sink.Writes);
Filters\RequestFormLimitsFilterTest.cs (3)
72var write = Assert.Single(sink.Writes); 97var write = Assert.Single(sink.Writes); 123var write = Assert.Single(sink.Writes);
Filters\RequestSizeLimitFilterTest.cs (3)
71var write = Assert.Single(sink.Writes); 95var write = Assert.Single(sink.Writes); 117var write = Assert.Single(sink.Writes);
Infrastructure\ActionSelectorTest.cs (1)
515var write = Assert.Single(sink.Writes);
Infrastructure\JsonResultExecutorTestBase.cs (2)
246var write = Assert.Single(sink.Writes); 264var write = Assert.Single(sink.Writes);
MvcCoreLoggerExtensionsTest.cs (11)
59var write = Assert.Single(testSink.Writes); 89var write = Assert.Single(testSink.Writes); 118var write = Assert.Single(testSink.Writes); 205var write = Assert.Single(testSink.Writes); 251var write = Assert.Single(testSink.Writes); 297var write = Assert.Single(testSink.Writes); 343var write = Assert.Single(testSink.Writes); 389var write = Assert.Single(testSink.Writes); 419var write = Assert.Single(testSink.Writes); 448var write = Assert.Single(testSink.Writes); 476var write = Assert.Single(testSink.Writes);
Routing\MvcRouteHandlerTests.cs (1)
45var write = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerOutputFormatterTest.cs (1)
665var write = Assert.Single(sink.Writes);
XmlSerializerOutputFormatterTest.cs (1)
482var write = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (2)
246var write = Assert.Single(sink.Writes); 264var write = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Mvc.RazorPages.Test (5)
PageLoggerExtensionsTest.cs (5)
34var write = Assert.Single(testSink.Writes); 62var write = Assert.Single(testSink.Writes); 90var write = Assert.Single(testSink.Writes); 118var write = Assert.Single(testSink.Writes); 150var write = Assert.Single(testSink.Writes);
Microsoft.AspNetCore.OutputCaching.Tests (1)
TestUtils.cs (1)
257internal static void AssertLoggedMessages(IEnumerable<WriteContext> messages, params LoggedMessage[] expectedMessages)
Microsoft.AspNetCore.RateLimiting.Tests (1)
RateLimitingMiddlewareTests.cs (1)
160var message = logMessages.First();
Microsoft.AspNetCore.RequestDecompression.Tests (9)
DefaultRequestDecompressionProviderTests.cs (1)
171private static void AssertLog(WriteContext log, LogLevel level, string message)
RequestDecompressionMiddlewareTests.cs (8)
152var logMessage = Assert.Single(logMessages); 185var logMessage = Assert.Single(logMessages); 660private static void AssertLog(WriteContext log, LogLevel level, string message) 666private static void AssertDecompressedWithLog(List<WriteContext> logMessages, string encoding) 668var logMessage = Assert.Single(logMessages); 672private static void AssertNoDecompressionProviderLog(List<WriteContext> logMessages) 674var logMessage = Assert.Single(logMessages); 678private static async Task<(List<WriteContext>, byte[])> InvokeMiddleware(
Microsoft.AspNetCore.ResponseCaching.Tests (1)
TestUtils.cs (1)
243internal static void AssertLoggedMessages(IEnumerable<WriteContext> messages, params LoggedMessage[] expectedMessages)
Microsoft.AspNetCore.ResponseCompression.Tests (3)
ResponseCompressionMiddlewareTest.cs (3)
1230private static async Task<(HttpResponseMessage, List<WriteContext>)> InvokeMiddleware( 1330private static void AssertLog(WriteContext log, LogLevel level, string message) 1336private void AssertCompressedWithLog(List<WriteContext> logMessages, string provider)
Microsoft.AspNetCore.Routing.Tests (9)
ConstraintMatcherTest.cs (1)
61var write = Assert.Single(sink.Writes);
EndpointRoutingMiddlewareTest.cs (7)
87var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "MatchSuccess")); 259var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "FallbackMatch")); 293var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "RequestSizeFeatureIsReadOnly")); 322var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "RequestSizeFeatureNotFound")); 350var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "RequestSizeLimitMetadataNotFound")); 384var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "MaxRequestBodySizeDisabled")); 389var write = Assert.Single(sink.Writes.Where(w => w.EventId.Name == "MaxRequestBodySizeSet"));
RouterMiddlewareTest.cs (1)
92var write = Assert.Single(sink.Writes);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
CertificatePathWatcherTests.cs (1)
474var writeContext = Assert.Single(testSink.Writes.Where(wc => wc.EventId.Name == eventName));
ConnectionDispatcherTests.cs (1)
66var critical = TestSink.Writes.SingleOrDefault(m => m.LogLevel == LogLevel.Critical);
Microsoft.AspNetCore.Session.Tests (6)
SessionTests.cs (6)
682var message = sink.Writes.First(); 731var message = sink.Writes.First(); 779var message = Assert.Single(sink.Writes); 879var sessionLogMessage = sink.Writes.Where(message => message.LoggerName.Equals(typeof(DistributedSession).FullName, StringComparison.Ordinal)).Single(); 884var sessionMiddlewareLogMessage = sink.Writes.Where(message => message.LoggerName.Equals(typeof(SessionMiddleware).FullName, StringComparison.Ordinal)).Single(); 1125var message = Assert.Single(sink.Writes);
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (12)
HubConnectionTests.cs (9)
125bool ExpectedError(WriteContext writeContext) 643bool ExpectedErrors(WriteContext writeContext) 1039bool ExpectedErrors(WriteContext writeContext) 1512bool ExpectedErrors(WriteContext writeContext) 2137bool ExpectedErrors(WriteContext writeContext) 2198bool ExpectedErrors(WriteContext writeContext) 2258bool ExpectedErrors(WriteContext writeContext) 2736var changeLog = Assert.Single(TestSink.Writes.Where(w => w.EventId.Name == "UserNameChanged")); 2849bool ExpectedErrors(WriteContext writeContext)
HubConnectionTests.Tracing.cs (2)
468bool ExpectedErrors(WriteContext writeContext) 564bool ExpectedErrors(WriteContext writeContext)
HubProtocolVersionTests.cs (1)
165bool ExpectedErrors(WriteContext writeContext)
Microsoft.AspNetCore.SignalR.Client.Tests (28)
HttpConnectionTests.ConnectionLifecycle.cs (5)
82bool ExpectedErrors(WriteContext writeContext) 133bool ExpectedErrors(WriteContext writeContext) 283bool ExpectedErrors(WriteContext writeContext) 325bool ExpectedErrors(WriteContext writeContext) 483bool ExpectedErrors(WriteContext writeContext)
HttpConnectionTests.Negotiate.cs (1)
577bool ExpectedError(WriteContext writeContext)
HubConnectionTests.ConnectionLifecycle.cs (3)
153bool ExpectedErrors(WriteContext writeContext) 492bool ExpectedErrors(WriteContext writeContext) 559bool ExpectedErrors(WriteContext writeContext)
HubConnectionTests.cs (5)
28bool ExpectedErrors(WriteContext writeContext) 144bool ExpectedErrors(WriteContext writeContext) 348bool ExpectedErrors(WriteContext writeContext) 405bool ExpectedErrors(WriteContext writeContext) 665bool ExpectedErrors(WriteContext writeContext)
HubConnectionTests.Reconnect.cs (13)
31bool ExpectedErrors(WriteContext writeContext) 72bool ExpectedErrors(WriteContext writeContext) 186bool ExpectedErrors(WriteContext writeContext) 281bool ExpectedErrors(WriteContext writeContext) 378bool ExpectedErrors(WriteContext writeContext) 474bool ExpectedErrors(WriteContext writeContext) 558bool ExpectedErrors(WriteContext writeContext) 620bool ExpectedErrors(WriteContext writeContext) 674bool ExpectedErrors(WriteContext writeContext) 730bool ExpectedErrors(WriteContext writeContext) 836bool ExpectedErrors(WriteContext writeContext) 956bool ExpectedErrors(WriteContext writeContext) 1047bool ExpectedErrors(WriteContext writeContext)
ServerSentEventsTransportTests.cs (1)
164bool ExpectedErrors(WriteContext writeContext)
Microsoft.AspNetCore.SignalR.Tests (21)
EndToEndTests.cs (7)
53bool ExpectedErrors(WriteContext writeContext) 376bool ExpectedErrors(WriteContext writeContext) 400bool ExpectedErrors(WriteContext writeContext) 430bool ExpectedErrors(WriteContext writeContext) 466bool ExpectedErrors(WriteContext writeContext) 601bool ExpectedErrors(WriteContext writeContext) 640bool ExpectedErrors(WriteContext writeContext)
HubConnectionHandlerTests.Activity.cs (4)
293bool ExpectedErrors(WriteContext writeContext) 340bool ExpectedErrors(WriteContext writeContext) 392bool ExpectedErrors(WriteContext writeContext) 443bool ExpectedErrors(WriteContext writeContext)
HubConnectionHandlerTests.cs (9)
731bool ExpectedErrors(WriteContext writeContext) 763bool ExpectedErrors(WriteContext writeContext) 900bool ExpectedErrors(WriteContext writeContext) 979bool ExpectedErrors(WriteContext writeContext) 1121bool ExpectedErrors(WriteContext writeContext) 1525bool ExpectedErrors(WriteContext writeContext) 2081bool ExpectedErrors(WriteContext writeContext) 3133bool ExpectedErrors(WriteContext writeContext) 3206bool ExpectedErrors(WriteContext writeContext)
HubFilterTests.cs (1)
867bool ExpectedErrors(WriteContext writeContext)
Microsoft.AspNetCore.SignalR.Tests.Utils (12)
ServerLogScope.cs (1)
38var write = logRecord.Write;
src\Shared\SignalR\FunctionalTestBase.cs (4)
14private readonly Func<WriteContext, bool> _globalExpectedErrorsFilter; 22private Func<WriteContext, bool> ResolveExpectedErrorsFilter(Func<WriteContext, bool> expectedErrorsFilter) 40public Task<InProcessTestServer<T>> StartServer<T>(Func<WriteContext, bool> expectedErrorsFilter = null, Action<KestrelServerOptions> configureKestrelServerOptions = null) where T : class
src\Shared\SignalR\LogRecord.cs (2)
13public WriteContext Write { get; } 15public LogRecord(DateTime timestamp, WriteContext write)
src\Shared\SignalR\VerifiableLoggedTest.cs (2)
20public virtual VerifyNoErrorsScope StartVerifiableLog(Func<WriteContext, bool> expectedErrorsFilter = null) 25private VerifyNoErrorsScope CreateScope(Func<WriteContext, bool> expectedErrorsFilter = null)
src\Shared\SignalR\VerifyNoErrorScope.cs (3)
15private readonly Func<WriteContext, bool> _expectedErrorsFilter; 22public VerifyNoErrorsScope(ILoggerFactory loggerFactory = null, IDisposable wrappedDisposable = null, Func<WriteContext, bool> expectedErrorsFilter = null) 49var r = record.Write;
Microsoft.Extensions.Localization.Tests (1)
ResourceManagerStringLocalizerTest.cs (1)
139var write = Assert.Single(Sink.Writes);