828 references to Throws
IIS.Tests (1)
InMemory.FunctionalTests (19)
Microsoft.AspNetCore.Antiforgery.Test (1)
Microsoft.AspNetCore.Authentication.Core.Test (1)
Microsoft.AspNetCore.Authentication.Test (2)
Microsoft.AspNetCore.Authorization.Test (2)
Microsoft.AspNetCore.Components.Forms.Tests (10)
Microsoft.AspNetCore.Components.Server.Tests (1)
Microsoft.AspNetCore.Components.Tests (18)
Microsoft.AspNetCore.Components.Web.Tests (3)
Microsoft.AspNetCore.Components.WebAssembly.Tests (1)
Microsoft.AspNetCore.CookiePolicy.Test (1)
Microsoft.AspNetCore.Cors.Test (3)
Microsoft.AspNetCore.DataProtection.Abstractions.Tests (1)
Microsoft.AspNetCore.DataProtection.Extensions.Tests (2)
Microsoft.AspNetCore.DataProtection.Tests (9)
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (2)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (6)
Microsoft.AspNetCore.Hosting.Tests (15)
Microsoft.AspNetCore.Http.Abstractions.Tests (27)
Microsoft.AspNetCore.Http.Connections.Tests (4)
Microsoft.AspNetCore.Http.Extensions.Tests (46)
Microsoft.AspNetCore.Http.Results.Tests (1)
Microsoft.AspNetCore.Http.Tests (15)
Microsoft.AspNetCore.HttpLogging.Tests (14)
Microsoft.AspNetCore.HttpOverrides.Tests (5)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (3)
Microsoft.AspNetCore.Identity.Test (12)
Microsoft.AspNetCore.InternalTesting.Tests (7)
Microsoft.AspNetCore.Localization.Tests (1)
Microsoft.AspNetCore.Mvc.Abstractions.Test (6)
Microsoft.AspNetCore.Mvc.Core.Test (40)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
Microsoft.AspNetCore.Mvc.IntegrationTests (6)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
Microsoft.AspNetCore.Mvc.Razor.Test (1)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (34)
Microsoft.AspNetCore.OpenApi.Tests (1)
Microsoft.AspNetCore.Owin.Tests (1)
Microsoft.AspNetCore.RateLimiting.Tests (8)
Microsoft.AspNetCore.ResponseCaching.Tests (1)
Microsoft.AspNetCore.Routing.FunctionalTests (1)
Microsoft.AspNetCore.Routing.Tests (44)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (12)
RequestBodyLimitTests.cs (9)
165var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
168ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
215var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
218ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
241var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
244ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
291var ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null)));
294ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null)));
321var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
Microsoft.AspNetCore.Server.HttpSys.Tests (4)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (73)
Microsoft.AspNetCore.Server.Kestrel.Tests (2)
Microsoft.AspNetCore.Shared.Tests (39)
CommandLineApplicationTests.cs (18)
70var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test", "one", "two", "three"));
111var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test2", "one", "two", "three"));
163var ex = Assert.Throws<InvalidOperationException>(() => app.Argument("second", "Second argument"));
203var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test", "--first"));
261var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedArg));
433var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption));
643var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption));
676var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption));
711var exception = Assert.Throws<CommandParsingException>(() => app.Execute("k", unexpectedOption, "run"));
814Assert.Throws<CommandParsingException>(() => app.Execute("subcmd", "-b", "B"));
829Assert.Throws<InvalidOperationException>(() => app.Execute("subcmd", "-a", "b"));
891Assert.Throws<CommandParsingException>(() => app.Execute("--nest2", "N2", "--nest1", "N1", "-g", "G"));
892Assert.Throws<CommandParsingException>(() => app.Execute("lvl1", "--nest2", "N2", "--nest1", "N1", "-g", "G"));
1117var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOptions));
1143var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption));
1154var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption));
1165var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption));
1219var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", firstOption));
Microsoft.AspNetCore.SignalR.Client.Tests (10)
Microsoft.AspNetCore.SignalR.Common.Tests (6)
Microsoft.AspNetCore.SignalR.Tests (6)
Microsoft.AspNetCore.TestHost.Tests (4)
Microsoft.AspNetCore.Tests (34)
WebApplicationTests.cs (34)
282Assert.Throws<InvalidOperationException>(() => app.Urls);
373Assert.Throws<NotSupportedException>(() => ((IHostBuilder)createBuilder().Host).Build());
380Assert.Throws<NotSupportedException>(() => ((IWebHostBuilder)createBuilder().WebHost).Build());
393Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.ApplicationKey, nameof(WebApplicationTests)));
394Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.EnvironmentKey, envName));
395Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.ContentRootKey, contentRoot));
396Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.WebRootKey, webRoot));
397Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.HostingStartupAssembliesKey, "hosting"));
398Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.HostingStartupExcludeAssembliesKey, "hostingexclude"));
399Assert.Throws<NotSupportedException>(() => builder.WebHost.UseEnvironment(envName));
400Assert.Throws<NotSupportedException>(() => builder.WebHost.UseContentRoot(contentRoot));
413Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
421Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
429Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
437Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
445Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
453Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder =>
1080Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureHostConfiguration(builder =>
1088Assert.Throws<NotSupportedException>(() => builder.Host.UseEnvironment(envName));
1089Assert.Throws<NotSupportedException>(() => builder.Host.UseContentRoot(contentRoot));
1620var ex = Assert.Throws<InvalidOperationException>(() => app.UseEndpoints(endpoints => { }));
1817Assert.Throws<InvalidOperationException>(() => builder.Services.AddSingleton<IService>(new Service()));
1819Assert.Throws<InvalidOperationException>(() => builder.Services.AddScoped<IService, Service>());
1821Assert.Throws<InvalidOperationException>(() => builder.Services.Remove(ServiceDescriptor.Singleton(new Service())));
1822Assert.Throws<InvalidOperationException>(() => builder.Services[0] = ServiceDescriptor.Singleton(new Service()));
1831var ex = Assert.Throws<NotSupportedException>(() => builder.WebHost.Configure(app => { }));
1832var ex1 = Assert.Throws<NotSupportedException>(() => builder.WebHost.Configure((context, app) => { }));
1833var ex2 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup<MyStartup>());
1834var ex3 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup(typeof(MyStartup)));
1835var ex4 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup(context => new MyStartup()));
1843var ex5 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHost(webHostBuilder => { }));
1844var ex6 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHost(webHostBuilder => { }, options => { }));
1845var ex7 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureSlimWebHost(webHostBuilder => { }, options => { }));
1846var ex8 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHostDefaults(webHostBuilder => { }));
Microsoft.AspNetCore.WebUtilities.Tests (2)
Microsoft.Build.Engine.UnitTests (23)
Evaluation\Expander_Tests.cs (8)
2608Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Microsoft.FOO.FileIO.FileSystem]::CurrentDirectory)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2609Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.Baz]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2610Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2611Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2612Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2613Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2614Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
3298var ex = Assert.Throws<InvalidProjectFileException>(
Microsoft.Build.Tasks.UnitTests (1)
Microsoft.DotNet.XUnitAssert.Tests (7)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
Microsoft.Extensions.Features.Tests (2)
Microsoft.Extensions.FileProviders.Embedded.Tests (1)
Microsoft.Extensions.Localization.Tests (4)
Microsoft.Extensions.ObjectPool.Tests (1)
Microsoft.JSInterop.Tests (23)
Infrastructure\DotNetDispatcherTest.cs (6)
169var ex = Assert.Throws<InvalidOperationException>(() =>
238var ex = Assert.Throws<ArgumentException>(
257var ex = Assert.Throws<ArgumentException>(
498var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, 0, default), "[7]"));
513var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(null, methodIdentifier, 1, default), argsJson));
527Assert.Throws<JsonException>(() =>
Microsoft.Net.Http.Headers.Tests (76)
Sockets.FunctionalTests (2)
System.ServiceModel.Http.Tests (30)
System.ServiceModel.NetTcp.Tests (9)
System.ServiceModel.Primitives.Tests (27)
System.ServiceModel.UnixDomainSocket.Tests (5)
System.Xaml.Tests (37)
System\Windows\Markup\NameReferenceConverterTests.cs (5)
87Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, "name"));
102Assert.Throws<InvalidCastException>(() => converter.ConvertFrom(context, null, "name"));
120Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, value));
179Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(context, null, "value", null));
194Assert.Throws<InvalidCastException>(() => converter.ConvertTo(context, null, "value", null));
xunit.assert (1)