1119 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)
29var ex = await Assert.ThrowsAsync<NotSupportedException>(() => SendAsync(server, "/Anonymous1", connection: null));
94var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => SendAsync(server, "/404", testConnection));
104var ex = await Assert.ThrowsAsync<TrueException>(() => SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob2"));
322var ex = await Assert.ThrowsAsync<Exception>(() => SendAsync(server, "/404", testConnection, "Negotiate OtherError"));
471return Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync(new ClaimsPrincipal()));
476return 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 (91)
UserManagerTest.cs (84)
606var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.CreateAsync(user));
623var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => manager.UpdateAsync(user));
766await Assert.ThrowsAsync<NotSupportedException>(() => manager.FindByEmailAsync(null));
767await Assert.ThrowsAsync<NotSupportedException>(() => manager.SetEmailAsync(null, null));
768await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetEmailAsync(null));
769await Assert.ThrowsAsync<NotSupportedException>(() => manager.IsEmailConfirmedAsync(null));
770await Assert.ThrowsAsync<NotSupportedException>(() => manager.ConfirmEmailAsync(null, null));
778await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetPhoneNumberAsync(null, null));
779await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetPhoneNumberAsync(null, null));
780await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetPhoneNumberAsync(null));
788await Assert.ThrowsAsync<NotSupportedException>(
790await Assert.ThrowsAsync<NotSupportedException>(
799await Assert.ThrowsAsync<NotSupportedException>(() => manager.CreateAsync(null, null));
800await Assert.ThrowsAsync<NotSupportedException>(() => manager.ChangePasswordAsync(null, null, null));
801await Assert.ThrowsAsync<NotSupportedException>(() => manager.AddPasswordAsync(null, null));
802await Assert.ThrowsAsync<NotSupportedException>(() => manager.RemovePasswordAsync(null));
803await Assert.ThrowsAsync<NotSupportedException>(() => manager.CheckPasswordAsync(null, null));
804await Assert.ThrowsAsync<NotSupportedException>(() => manager.HasPasswordAsync(null));
814await Assert.ThrowsAsync<NotSupportedException>(() => manager.UpdateSecurityStampAsync(null));
815await Assert.ThrowsAsync<NotSupportedException>(() => manager.GetSecurityStampAsync(null));
816await Assert.ThrowsAsync<NotSupportedException>(
818await Assert.ThrowsAsync<NotSupportedException>(
827await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddLoginAsync(null, null));
828await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveLoginAsync(null, null, null));
829await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLoginsAsync(null));
830await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.FindByLoginAsync(null, null));
838await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddClaimAsync(null, null));
839await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ReplaceClaimAsync(null, null, null));
840await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveClaimAsync(null, null));
841await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetClaimsAsync(null));
876await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), "A", "purpose"));
973await Assert.ThrowsAsync<NotImplementedException>(() => manager.GenerateUserTokenAsync(new PocoUser(), TokenOptions.DefaultProvider, "purpose"));
981await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetTwoFactorEnabledAsync(null));
983Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetTwoFactorEnabledAsync(null, true));
991await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetLockoutEnabledAsync(null));
992await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.SetLockoutEnabledAsync(null, true));
993await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AccessFailedAsync(null));
994await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsLockedOutAsync(null));
995await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.ResetAccessFailedCountAsync(null));
996await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetAccessFailedCountAsync(null));
1004await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRoleAsync(null, "bogus"));
1005await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.AddToRolesAsync(null, null));
1006await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.GetRolesAsync(null));
1007await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRoleAsync(null, "bogus"));
1008await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.RemoveFromRolesAsync(null, null));
1009await Assert.ThrowsAsync<NotSupportedException>(async () => await manager.IsInRoleAsync(null, "bogus"));
1045var error = await Assert.ThrowsAsync<TException>(code);
1238await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimAsync(null, null));
1239await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddClaimsAsync(null, null));
1240await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddLoginAsync(null, null));
1241await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddPasswordAsync(null, null));
1242await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRoleAsync(null, null));
1243await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.AddToRolesAsync(null, null));
1244await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ChangePasswordAsync(null, null, null));
1245await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetClaimsAsync(null));
1246await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetLoginsAsync(null));
1247await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetRolesAsync(null));
1248await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsInRoleAsync(null, null));
1249await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimAsync(null, null));
1250await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveClaimsAsync(null, null));
1251await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveLoginAsync(null, null, null));
1252await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemovePasswordAsync(null));
1253await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRoleAsync(null, null));
1254await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.RemoveFromRolesAsync(null, null));
1255await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByLoginAsync(null, null));
1256await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByIdAsync(null));
1257await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByNameAsync(null));
1258await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null));
1259await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.CreateAsync(null, null));
1260await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateAsync(null));
1261await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.DeleteAsync(null));
1262await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ReplaceClaimAsync(null, null, null));
1263await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.UpdateSecurityStampAsync(null));
1264await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetSecurityStampAsync(null));
1265await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GeneratePasswordResetTokenAsync(null));
1266await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ResetPasswordAsync(null, null, null));
1267await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GenerateEmailConfirmationTokenAsync(null));
1268await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.IsEmailConfirmedAsync(null));
1269await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.ConfirmEmailAsync(null, null));
1270await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.SetPasskeyAsync(null, null));
1271await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeysAsync(null));
1272await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.GetPasskeyAsync(null, null));
1273await Assert.ThrowsAsync<ObjectDisposedException>(() => manager.FindByPasskeyIdAsync(null));
1274await 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.Emit3.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (3)
Microsoft.CodeAnalysis.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (14)
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
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 (1)
xunit.assert (1)