104 references to ThrowsAnyAsync
Aspire.Hosting.Tests (2)
Dcp\ApplicationExecutorTests.cs (1)
512await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await moveNextTask);
DistributedApplicationTests.cs (1)
707await Assert.ThrowsAnyAsync<Exception>(async () =>
IIS.Tests (2)
MaxRequestBodySizeTests.cs (2)
324requestRejectedEx1 = await Assert.ThrowsAnyAsync<BadHttpRequestException>( 326requestRejectedEx2 = await Assert.ThrowsAnyAsync<BadHttpRequestException>(
InMemory.FunctionalTests (8)
EventSourceTests.cs (1)
302await Assert.ThrowsAnyAsync<Exception>(() => sslStream.AuthenticateAsClientAsync(clientAuthOptions, handshakeCts.Token));
Http2\Http2StreamTests.cs (2)
3429var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length)); 3454var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length));
HttpsConnectionMiddlewareTests.cs (2)
217await Assert.ThrowsAnyAsync<Exception>( 1154var ex = await Assert.ThrowsAnyAsync<Exception>(
HttpsTests.cs (2)
94var ex = await Assert.ThrowsAnyAsync<Exception>(() => 697await Assert.ThrowsAnyAsync<Exception>(() =>
KestrelMetricsTests.cs (1)
820await Assert.ThrowsAnyAsync<Exception>(() => stream.ReadUntilEndAsync()).DefaultTimeout();
Interop.FunctionalTests (10)
Http2WebSocketInteropTests.cs (2)
154var ex = await Assert.ThrowsAnyAsync<Exception>(() => tcs.Task); 161await Assert.ThrowsAnyAsync<Exception>(() => wsClient.ReceiveAsync(new byte[1], default));
Http3\Http3RequestTests.cs (3)
515await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask).DefaultTimeout(); 680var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => client.SendAsync(request, CancellationToken.None)).DefaultTimeout(); 2074var ex = await Assert.ThrowsAnyAsync<Exception>(() => readTask).DefaultTimeout();
Http3\Http3TlsTests.cs (1)
202var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => sendTask).DefaultTimeout();
HttpClientHttp2InteropTests.cs (4)
744await Assert.ThrowsAnyAsync<OperationCanceledException>(() => clientEcho.Task.DefaultTimeout()); 803await Assert.ThrowsAnyAsync<OperationCanceledException>(() => clientEcho.Task.DefaultTimeout()); 849await Assert.ThrowsAnyAsync<Exception>(() => requestTask).DefaultTimeout(); 894await Assert.ThrowsAnyAsync<Exception>(() => requestTask).DefaultTimeout();
Microsoft.AspNetCore.Authentication.Test (7)
GoogleTests.cs (6)
371var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode")); 406var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); 524var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); 634var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); 686var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); 824var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode"));
TwitterTests.cs (1)
119var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-twitter"));
Microsoft.AspNetCore.Components.Tests (7)
RendererTest.cs (3)
1463await Assert.ThrowsAnyAsync<OperationCanceledException>(() => task); 1495await Assert.ThrowsAnyAsync<OperationCanceledException>(() => task); 1531await Assert.ThrowsAnyAsync<OperationCanceledException>(() => task);
Rendering\RendererSynchronizationContextTest.cs (4)
489await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await task); 577await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await task); 671await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await task); 759await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await task);
Microsoft.AspNetCore.Hosting.Tests (2)
WebHostBuilderTests.cs (2)
1356var stopEx = await Assert.ThrowsAnyAsync<Exception>(() => host.StopAsync()); 1382var stopEx = await Assert.ThrowsAnyAsync<Exception>(() => host.StopAsync());
Microsoft.AspNetCore.Http.Extensions.Tests (4)
HttpResponseJsonExtensionsTests.cs (2)
389await Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Response.WriteAsJsonAsync(AsyncEnumerable(), typeof(IAsyncEnumerable<int>), cts.Token)); 423await Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Response.WriteAsJsonAsync(AsyncEnumerable(), cts.Token));
RequestDelegateFactoryTests.cs (1)
1520var exception = await Assert.ThrowsAnyAsync<InvalidOperationException>(async () => await requestDelegate(httpContext));
SendFileResponseExtensionsTests.cs (1)
55await Assert.ThrowsAnyAsync<OperationCanceledException>(
Microsoft.AspNetCore.Identity.FunctionalTests (2)
LoginTests.cs (2)
174await Assert.ThrowsAnyAsync<XunitException>(() => UserStories.LoginExistingUserAsync(newClient, userName, password)); 199await Assert.ThrowsAnyAsync<XunitException>(() => UserStories.LoginExistingUserAsync(newClient, userName, password));
Microsoft.AspNetCore.InternalTesting.Tests (2)
HttpClientSlimTest.cs (2)
31await Assert.ThrowsAnyAsync<HttpRequestException>(() => HttpClientSlim.GetStringAsync(address)); 49await Assert.ThrowsAnyAsync<HttpRequestException>(
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (8)
Listener\RequestBodyTests.cs (1)
191await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await responseTask);
Listener\ResponseBodyTests.cs (4)
248await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask); 284await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask); 319await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask); 346await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
Listener\ServerTests.cs (1)
37await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
ResponseSendFileTests.cs (2)
523await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask); 566await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (5)
HubConnectionTests.cs (4)
143var ex = await Assert.ThrowsAnyAsync<Exception>(() => connection.StartAsync()).DefaultTimeout(); 1021await Assert.ThrowsAnyAsync<OperationCanceledException>(() => connection.StreamAsChannelAsync<int>("Stream", 5, cts.Token).DefaultTimeout()); 1525var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => hubConnection.StartAsync().DefaultTimeout()); 2905var ex = await Assert.ThrowsAnyAsync<Exception>(() => resultTask);
HubConnectionTests.Tracing.cs (1)
608await Assert.ThrowsAnyAsync<Exception>(
Microsoft.AspNetCore.SignalR.Client.Tests (3)
HttpConnectionFactoryTests.cs (1)
40await Assert.ThrowsAnyAsync<Exception>(async () => await factory.ConnectAsync(new UriEndPoint(new Uri("http://example.com"))));
HubConnectionTests.ConnectionLifecycle.cs (2)
516await Assert.ThrowsAnyAsync<OperationCanceledException>(() => hubConnection.StartAsync()).DefaultTimeout(); 594await Assert.ThrowsAnyAsync<OperationCanceledException>(() => startTask).DefaultTimeout();
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
HubLifetimeManagerTestBase.cs (1)
309await Assert.ThrowsAnyAsync<Exception>(() => invoke2).DefaultTimeout();
Microsoft.AspNetCore.TestHost.Tests (5)
TestClientTests.cs (5)
493await Assert.ThrowsAnyAsync<Exception>(() => requestStream.WriteAsync(buffer).AsTask()); 734await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await client.ConnectAsync(new Uri("http://localhost"), tokenSource.Token)); 856var exception = await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await tcs.Task); 880var response = await Assert.ThrowsAnyAsync<OperationCanceledException>(() => client.GetAsync("http://localhost:12345", cts.Token)); 882var exception = await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await tcs.Task);
Microsoft.AspNetCore.WebSockets.Tests (1)
WebSocketMiddlewareTests.cs (1)
842var ex = await Assert.ThrowsAnyAsync<Exception>(() => tcs.Task);
Microsoft.CodeAnalysis.Workspaces.UnitTests (21)
FindAllDeclarationsTests.cs (21)
102await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 111await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 121await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 268await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 277await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 287await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 373await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 382await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 392await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 440await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 449await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 459await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 507await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 516await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 526await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 571await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 580await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 590await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => 635await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 644await Assert.ThrowsAnyAsync<ArgumentNullException>(async () => 654await Assert.ThrowsAnyAsync<OperationCanceledException>(async () =>
Microsoft.DotNet.XUnitAssert.Tests (5)
ExceptionAssertsTests.cs (5)
632 await Assert.ThrowsAsync<ArgumentNullException>("testCode", () => Assert.ThrowsAnyAsync<ArgumentException>(default(Func<Task>)!)); 640 var ex = await Record.ExceptionAsync(() => Assert.ThrowsAnyAsync<ArgumentException>(testCode)); 656 await Assert.ThrowsAnyAsync<ArgumentException>(testCode); 665 var ex = await Record.ExceptionAsync(() => Assert.ThrowsAnyAsync<ArgumentException>(testCode)); 682 await Assert.ThrowsAnyAsync<ArgumentException>(testCode);
Microsoft.Extensions.Diagnostics.Testing.Tests (2)
Metrics\MetricCollectorTests.cs (2)
291await Assert.ThrowsAnyAsync<OperationCanceledException>(() => wait); 341await Assert.ThrowsAnyAsync<OperationCanceledException>(() => collector.WaitForMeasurementsAsync(1, TimeSpan.FromMilliseconds(50)));
Sockets.FunctionalTests (5)
src\Servers\Kestrel\test\FunctionalTests\ConnectionMiddlewareTests.cs (1)
31await Assert.ThrowsAnyAsync<IOException>(async () =>
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
1087await Assert.ThrowsAnyAsync<IOException>(() => readTcs.Task).DefaultTimeout();
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (3)
250await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await writeTcs.Task).DefaultTimeout(); 343await Assert.ThrowsAnyAsync<OperationCanceledException>(() => writeTcs.Task).DefaultTimeout(); 843await Assert.ThrowsAnyAsync<OperationCanceledException>(() => copyToAsyncCts.Task).DefaultTimeout();
System.Windows.Forms.Primitives.TestUtilities (1)
Extensions\AssertExtensions.cs (1)
273OperationCanceledException oce = await Assert.ThrowsAnyAsync<OperationCanceledException>(testCode);
VBCSCompiler.UnitTests (1)
BuildClientTests.cs (1)
153await Assert.ThrowsAnyAsync<OperationCanceledException>(