1116 references to ThrowsAsync
Binding.ReliableSession.IntegrationTests (2)
Diagnostics.EFCore.FunctionalTests (3)
IIS.FunctionalTests (4)
InMemory.FunctionalTests (66)
InProcessWebSite (4)
Interop.FunctionalTests (18)
Microsoft.AspNetCore.Antiforgery.Test (9)
Microsoft.AspNetCore.Authentication.Core.Test (10)
Microsoft.AspNetCore.Authentication.Negotiate.Test (9)
NegotiateHandlerTests.cs (6)
36var ex = await Assert.ThrowsAsync<NotSupportedException>(() => SendAsync(server, "/Anonymous1", connection: null));
101var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => SendAsync(server, "/404", testConnection));
111var ex = await Assert.ThrowsAsync<TrueException>(() => SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob2"));
329var ex = await Assert.ThrowsAsync<Exception>(() => SendAsync(server, "/404", testConnection, "Negotiate OtherError"));
478return Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync(new ClaimsPrincipal()));
483return Assert.ThrowsAsync<InvalidOperationException>(() => context.SignOutAsync());
Microsoft.AspNetCore.Authentication.Test (75)
AuthenticationMetricsTest.cs (5)
114var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => authenticationService.AuthenticateAsync(httpContext, scheme: "custom"));
166var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => authenticationService.ChallengeAsync(httpContext, scheme: "custom", properties: null));
217var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => authenticationService.ForbidAsync(httpContext, scheme: "custom", properties: null));
268var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => authenticationService.SignInAsync(httpContext, scheme: "custom", new ClaimsPrincipal(), properties: null));
319var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => authenticationService.SignOutAsync(httpContext, scheme: "custom", properties: null));
Microsoft.AspNetCore.Authorization.Test (4)
Microsoft.AspNetCore.Components.Endpoints.Tests (11)
Microsoft.AspNetCore.Components.Server.Tests (22)
Circuits\RemoteJSDataStreamTest.cs (11)
114var ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
128var ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout());
133ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
147var ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout());
152ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
167var ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout());
172ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
191var ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 7, chunk, error: null).DefaultTimeout());
196ex = await Assert.ThrowsAsync<EndOfStreamException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
232var ex = await Assert.ThrowsAsync<TimeoutException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
281var ex = await Assert.ThrowsAsync<TimeoutException>(async () => await remoteJSDataStream.CopyToAsync(mem).DefaultTimeout());
Microsoft.AspNetCore.Components.Tests (31)
Microsoft.AspNetCore.Components.Web.Tests (15)
Microsoft.AspNetCore.Components.WebAssembly.Tests (4)
Microsoft.AspNetCore.Components.WebView.Test (1)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (3)
Microsoft.AspNetCore.Diagnostics.Tests (3)
Microsoft.AspNetCore.HeaderPropagation.Tests (2)
Microsoft.AspNetCore.HostFiltering.Tests (1)
Microsoft.AspNetCore.Hosting.Tests (6)
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (2)
Microsoft.AspNetCore.Http.Abstractions.Tests (9)
Microsoft.AspNetCore.Http.Connections.Tests (6)
Microsoft.AspNetCore.Http.Results.Tests (17)
Microsoft.AspNetCore.Http.Tests (10)
Microsoft.AspNetCore.HttpLogging.Tests (3)
Microsoft.AspNetCore.HttpsPolicy.Tests (1)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (26)
UserStoreTest.cs (24)
74await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddClaimsAsync(null, null));
75await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddLoginAsync(null, null));
76await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddToRoleAsync(null, null));
77await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetClaimsAsync(null));
78await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetLoginsAsync(null));
79await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetRolesAsync(null));
80await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.IsInRoleAsync(null, null));
81await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveClaimsAsync(null, null));
82await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveLoginAsync(null, null, null));
83await Assert.ThrowsAsync<ObjectDisposedException>(
85await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveClaimsAsync(null, null));
86await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.ReplaceClaimAsync(null, null, null));
87await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByLoginAsync(null, null));
88await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByIdAsync(null));
89await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByNameAsync(null));
90await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.CreateAsync(null));
91await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.UpdateAsync(null));
92await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.DeleteAsync(null));
93await Assert.ThrowsAsync<ObjectDisposedException>(
95await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetEmailConfirmedAsync(null));
96await Assert.ThrowsAsync<ObjectDisposedException>(
98await Assert.ThrowsAsync<ObjectDisposedException>(
203await Assert.ThrowsAsync<InvalidOperationException>(async () => await manager.FindByEmailAsync("dupe@dupe.com"));
212await Assert.ThrowsAsync<InvalidOperationException>(
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Microsoft.AspNetCore.Identity.Specification.Tests (4)
Microsoft.AspNetCore.Identity.Test (94)
UserManagerTest.cs (84)
686var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.CreateAsync(user));
713var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.UpdateAsync(user));
895await Assert.ThrowsAsync<NotSupportedException>(() => manager.FindByEmailAsync(null));
896await Assert.ThrowsAsync<NotSupportedException>(() => manager.SetEmailAsync(null, null));
897await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetEmailAsync(null));
898await Assert.ThrowsAsync<NotSupportedException>(() => manager.IsEmailConfirmedAsync(null));
899await Assert.ThrowsAsync<NotSupportedException>(() => manager.ConfirmEmailAsync(null, null));
922await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetPhoneNumberAsync(null, null));
923await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ChangePhoneNumberAsync(null, null, null));
924await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetPhoneNumberAsync(null));
948await Assert.ThrowsAsync<NotSupportedException>(
950await Assert.ThrowsAsync<NotSupportedException>(
977await Assert.ThrowsAsync<NotSupportedException>(() => manager.CreateAsync(null, null));
978await Assert.ThrowsAsync<NotSupportedException>(() => manager.ChangePasswordAsync(null, null, null));
979await Assert.ThrowsAsync<NotSupportedException>(() => manager.AddPasswordAsync(null, null));
980await Assert.ThrowsAsync<NotSupportedException>(() => manager.RemovePasswordAsync(null));
981await Assert.ThrowsAsync<NotSupportedException>(() => manager.CheckPasswordAsync(null, null));
982await Assert.ThrowsAsync<NotSupportedException>(() => manager.HasPasswordAsync(null));
1023await Assert.ThrowsAsync<NotSupportedException>(() => manager.UpdateSecurityStampAsync(null));
1024await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetSecurityStampAsync(null));
1025await Assert.ThrowsAsync<NotSupportedException>(
1027await Assert.ThrowsAsync<NotSupportedException>(
1052await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddLoginAsync(null, null));
1053await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveLoginAsync(null, null, null));
1054await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLoginsAsync(null));
1055await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.FindByLoginAsync(null, null));
1078await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddClaimAsync(null, null));
1079await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ReplaceClaimAsync(null, null, null));
1080await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveClaimAsync(null, null));
1081await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetClaimsAsync(null));
1133await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), "A", "purpose"));
1230await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), TokenOptions.DefaultProvider, "purpose"));
1238await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetTwoFactorEnabledAsync(null));
1240Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetTwoFactorEnabledAsync(null, true));
1281await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLockoutEnabledAsync(null));
1282await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetLockoutEnabledAsync(null, true));
1283await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AccessFailedAsync(null));
1284await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsLockedOutAsync(null));
1285await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ResetAccessFailedCountAsync(null));
1286await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetAccessFailedCountAsync(null));
1294await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRoleAsync(null, "bogus"));
1295await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRolesAsync(null, null));
1296await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetRolesAsync(null));
1297await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRoleAsync(null, "bogus"));
1298await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRolesAsync(null, null));
1299await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsInRoleAsync(null, "bogus"));
1335var error = await Assert.ThrowsAsync<TException>(code);
1528await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimAsync(null, null));
1529await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimsAsync(null, null));
1530await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddLoginAsync(null, null));
1531await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddPasswordAsync(null, null));
1532await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRoleAsync(null, null));
1533await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRolesAsync(null, null));
1534await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ChangePasswordAsync(null, null, null));
1535await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetClaimsAsync(null));
1536await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetLoginsAsync(null));
1537await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetRolesAsync(null));
1538await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsInRoleAsync(null, null));
1539await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimAsync(null, null));
1540await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimsAsync(null, null));
1541await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveLoginAsync(null, null, null));
1542await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemovePasswordAsync(null));
1543await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRoleAsync(null, null));
1544await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRolesAsync(null, null));
1545await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByLoginAsync(null, null));
1546await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByIdAsync(null));
1547await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByNameAsync(null));
1548await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null));
1549await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null, null));
1550await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateAsync(null));
1551await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.DeleteAsync(null));
1552await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ReplaceClaimAsync(null, null, null));
1553await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateSecurityStampAsync(null));
1554await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetSecurityStampAsync(null));
1555await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GeneratePasswordResetTokenAsync(null));
1556await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ResetPasswordAsync(null, null, null));
1557await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GenerateEmailConfirmationTokenAsync(null));
1558await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsEmailConfirmedAsync(null));
1559await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ConfirmEmailAsync(null, null));
1560await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddOrUpdatePasskeyAsync(null, null));
1561await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeysAsync(null));
1562await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeyAsync(null, null));
1563await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByPasskeyIdAsync(null));
1564await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemovePasskeyAsync(null, null));
Microsoft.AspNetCore.InternalTesting (2)
Microsoft.AspNetCore.InternalTesting.Tests (6)
Microsoft.AspNetCore.Mvc.Core.Test (46)
Microsoft.AspNetCore.Mvc.Core.TestCommon (5)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (12)
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
Microsoft.AspNetCore.Mvc.IntegrationTests (22)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (5)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
Microsoft.AspNetCore.Mvc.Razor.Test (21)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (23)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (21)
Microsoft.AspNetCore.OpenApi.Tests (5)
Microsoft.AspNetCore.OutputCaching.Tests (3)
Microsoft.AspNetCore.RateLimiting.Tests (1)
Microsoft.AspNetCore.Razor.Runtime.Test (2)
Microsoft.AspNetCore.RequestDecompression.Tests (1)
Microsoft.AspNetCore.Rewrite.Tests (1)
Microsoft.AspNetCore.Routing.FunctionalTests (7)
Microsoft.AspNetCore.Routing.Tests (10)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (46)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (55)
BodyControlTests.cs (13)
29await Assert.ThrowsAsync<Exception>(() => request.ReadAsync(new byte[1], 0, 1)));
31await Assert.ThrowsAsync<Exception>(async () => await requestPipe.ReadAsync()));
44var writeEx = await Assert.ThrowsAsync<InvalidOperationException>(() => response.WriteAsync(new byte[1], 0, 1));
48await Assert.ThrowsAsync<Exception>(() => request.ReadAsync(new byte[1], 0, 1)));
51await Assert.ThrowsAsync<Exception>(() => upgrade.ReadAsync(new byte[1], 0, 1)));
54await Assert.ThrowsAsync<Exception>(async () => await requestPipe.ReadAsync()));
70var writeEx = await Assert.ThrowsAsync<InvalidOperationException>(() => response.WriteAsync(new byte[1], 0, 1));
74await Assert.ThrowsAsync<Exception>(() => request.ReadAsync(new byte[1], 0, 1)));
77await Assert.ThrowsAsync<Exception>(() => upgrade.ReadAsync(new byte[1], 0, 1)));
79await Assert.ThrowsAsync<Exception>(async () => await requestPipe.ReadAsync()));
120await Assert.ThrowsAsync<ObjectDisposedException>(async () => await requestPipe.ReadAsync());
137await Assert.ThrowsAsync<ObjectDisposedException>(async () => await responsePipe.WriteAsync(new Memory<byte>()));
138await Assert.ThrowsAsync<ObjectDisposedException>(async () => await responsePipe.FlushAsync());
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (19)
Microsoft.AspNetCore.Session.Tests (4)
Microsoft.AspNetCore.Shared.Tests (4)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (23)
Microsoft.AspNetCore.SignalR.Client.Tests (57)
Microsoft.AspNetCore.SignalR.Specification.Tests (10)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Microsoft.AspNetCore.SignalR.Tests (17)
Microsoft.AspNetCore.TestHost.Tests (31)
Microsoft.AspNetCore.Tests (4)
Microsoft.AspNetCore.WebUtilities.Tests (23)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
Microsoft.CodeAnalysis.Features.UnitTests (1)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Microsoft.CodeAnalysis.LanguageServer.UnitTests (2)
Microsoft.CodeAnalysis.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (12)
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (2)
Microsoft.DotNet.Build.Tasks.Feed.Tests (1)
Microsoft.DotNet.XUnitAssert.Tests (5)
Microsoft.Extensions.AI.Abstractions.Tests (5)
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (3)
Microsoft.Extensions.AI.OpenAI.Tests (11)
Microsoft.Extensions.AI.Tests (25)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Caching.SqlServer.Tests (1)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (1)
Microsoft.Extensions.DataIngestion.Tests (6)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (2)
Microsoft.Extensions.Diagnostics.Testing.Tests (6)
Microsoft.Extensions.Http.Diagnostics.Tests (5)
Microsoft.Extensions.Http.Polly.Tests (6)
Microsoft.Extensions.Http.Resilience.Tests (3)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (1)
Microsoft.Extensions.ServiceDiscovery.Tests (2)
Microsoft.Extensions.TimeProvider.Testing.Tests (5)
Microsoft.Extensions.Validation.GeneratorTests (1)
Microsoft.Extensions.Validation.Tests (1)
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Gen.Metrics.Unit.Tests (1)
Microsoft.JSInterop.Tests (9)
Microsoft.ML.Core.Tests (2)
UnitTests\TestResourceDownload.cs (2)
61await Assert.ThrowsAsync<NotSupportedException>(() => ResourceManagerUtils.Instance.EnsureResourceAsync(env, ch, "Image/ResNet_18_Updated.model", fileName, saveToDir, 10 * 1000));
90await Assert.ThrowsAsync<NotSupportedException>(() => ResourceManagerUtils.Instance.EnsureResourceAsync(env, ch, "Image/ResNet_18_Updated.model", fileName, saveToDir, 10 * 1000));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
Sockets.BindTests (1)
Sockets.FunctionalTests (1)
VBCSCompiler.UnitTests (2)
xunit.assert (1)