1133 references to ThrowsAsync
Binding.ReliableSession.IntegrationTests (2)
Diagnostics.EFCore.FunctionalTests (3)
IIS.FunctionalTests (4)
InMemory.FunctionalTests (66)
InProcessWebSite (1)
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 (8)
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 (29)
Microsoft.AspNetCore.Components.Web.Tests (12)
Microsoft.AspNetCore.Components.WebAssembly.Tests (4)
Microsoft.AspNetCore.Components.WebView.Test (1)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
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.Extensions.Tests (42)
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)
68await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddClaimsAsync(null, null));
69await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddLoginAsync(null, null));
70await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.AddToRoleAsync(null, null));
71await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetClaimsAsync(null));
72await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetLoginsAsync(null));
73await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetRolesAsync(null));
74await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.IsInRoleAsync(null, null));
75await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveClaimsAsync(null, null));
76await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveLoginAsync(null, null, null));
77await Assert.ThrowsAsync<ObjectDisposedException>(
79await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.RemoveClaimsAsync(null, null));
80await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.ReplaceClaimAsync(null, null, null));
81await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByLoginAsync(null, null));
82await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByIdAsync(null));
83await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.FindByNameAsync(null));
84await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.CreateAsync(null));
85await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.UpdateAsync(null));
86await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.DeleteAsync(null));
87await Assert.ThrowsAsync<ObjectDisposedException>(
89await Assert.ThrowsAsync<ObjectDisposedException>(async () => await store.GetEmailConfirmedAsync(null));
90await Assert.ThrowsAsync<ObjectDisposedException>(
92await Assert.ThrowsAsync<ObjectDisposedException>(
197await Assert.ThrowsAsync<InvalidOperationException>(async () => await manager.FindByEmailAsync("dupe@dupe.com"));
207await Assert.ThrowsAsync<InvalidOperationException>(
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Microsoft.AspNetCore.Identity.Specification.Tests (4)
Microsoft.AspNetCore.Identity.Test (94)
UserManagerTest.cs (84)
685var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.CreateAsync(user));
712var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.UpdateAsync(user));
894await Assert.ThrowsAsync<NotSupportedException>(() => manager.FindByEmailAsync(null));
895await Assert.ThrowsAsync<NotSupportedException>(() => manager.SetEmailAsync(null, null));
896await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetEmailAsync(null));
897await Assert.ThrowsAsync<NotSupportedException>(() => manager.IsEmailConfirmedAsync(null));
898await Assert.ThrowsAsync<NotSupportedException>(() => manager.ConfirmEmailAsync(null, null));
921await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetPhoneNumberAsync(null, null));
922await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ChangePhoneNumberAsync(null, null, null));
923await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetPhoneNumberAsync(null));
947await Assert.ThrowsAsync<NotSupportedException>(
949await Assert.ThrowsAsync<NotSupportedException>(
976await Assert.ThrowsAsync<NotSupportedException>(() => manager.CreateAsync(null, null));
977await Assert.ThrowsAsync<NotSupportedException>(() => manager.ChangePasswordAsync(null, null, null));
978await Assert.ThrowsAsync<NotSupportedException>(() => manager.AddPasswordAsync(null, null));
979await Assert.ThrowsAsync<NotSupportedException>(() => manager.RemovePasswordAsync(null));
980await Assert.ThrowsAsync<NotSupportedException>(() => manager.CheckPasswordAsync(null, null));
981await Assert.ThrowsAsync<NotSupportedException>(() => manager.HasPasswordAsync(null));
1022await Assert.ThrowsAsync<NotSupportedException>(() => manager.UpdateSecurityStampAsync(null));
1023await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetSecurityStampAsync(null));
1024await Assert.ThrowsAsync<NotSupportedException>(
1026await Assert.ThrowsAsync<NotSupportedException>(
1051await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddLoginAsync(null, null));
1052await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveLoginAsync(null, null, null));
1053await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLoginsAsync(null));
1054await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.FindByLoginAsync(null, null));
1077await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddClaimAsync(null, null));
1078await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ReplaceClaimAsync(null, null, null));
1079await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveClaimAsync(null, null));
1080await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetClaimsAsync(null));
1132await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), "A", "purpose"));
1229await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), TokenOptions.DefaultProvider, "purpose"));
1237await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetTwoFactorEnabledAsync(null));
1239Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetTwoFactorEnabledAsync(null, true));
1247await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLockoutEnabledAsync(null));
1248await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetLockoutEnabledAsync(null, true));
1249await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AccessFailedAsync(null));
1250await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsLockedOutAsync(null));
1251await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ResetAccessFailedCountAsync(null));
1252await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetAccessFailedCountAsync(null));
1260await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRoleAsync(null, "bogus"));
1261await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRolesAsync(null, null));
1262await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetRolesAsync(null));
1263await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRoleAsync(null, "bogus"));
1264await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRolesAsync(null, null));
1265await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsInRoleAsync(null, "bogus"));
1301var error = await Assert.ThrowsAsync<TException>(code);
1494await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimAsync(null, null));
1495await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimsAsync(null, null));
1496await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddLoginAsync(null, null));
1497await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddPasswordAsync(null, null));
1498await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRoleAsync(null, null));
1499await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRolesAsync(null, null));
1500await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ChangePasswordAsync(null, null, null));
1501await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetClaimsAsync(null));
1502await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetLoginsAsync(null));
1503await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetRolesAsync(null));
1504await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsInRoleAsync(null, null));
1505await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimAsync(null, null));
1506await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimsAsync(null, null));
1507await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveLoginAsync(null, null, null));
1508await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemovePasswordAsync(null));
1509await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRoleAsync(null, null));
1510await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRolesAsync(null, null));
1511await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByLoginAsync(null, null));
1512await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByIdAsync(null));
1513await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByNameAsync(null));
1514await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null));
1515await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null, null));
1516await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateAsync(null));
1517await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.DeleteAsync(null));
1518await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ReplaceClaimAsync(null, null, null));
1519await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateSecurityStampAsync(null));
1520await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetSecurityStampAsync(null));
1521await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GeneratePasswordResetTokenAsync(null));
1522await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ResetPasswordAsync(null, null, null));
1523await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GenerateEmailConfirmationTokenAsync(null));
1524await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsEmailConfirmedAsync(null));
1525await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ConfirmEmailAsync(null, null));
1526await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.SetPasskeyAsync(null, null));
1527await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeysAsync(null));
1528await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeyAsync(null, null));
1529await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByPasskeyIdAsync(null));
1530await 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 (2)
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.Features.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.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (15)
Microsoft.CodeAnalysis.Workspaces.UnitTests (11)
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (1)
Microsoft.DotNet.XUnitAssert.Tests (5)
Microsoft.Extensions.AI.Abstractions.Tests (4)
Microsoft.Extensions.AI.AzureAIInference.Tests (4)
Microsoft.Extensions.AI.Ollama.Tests (3)
Microsoft.Extensions.AI.OpenAI.Tests (2)
Microsoft.Extensions.AI.Tests (20)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Caching.SqlServer.Tests (1)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (1)
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.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.VisualStudio.LanguageServices.CSharp.UnitTests (2)
Sockets.BindTests (1)
Sockets.FunctionalTests (1)
VBCSCompiler.UnitTests (2)
xunit.assert (1)