3121 references to Throws
Aspire.Azure.Messaging.WebPubSub.Tests (1)
Aspire.Components.Common.Tests (2)
Aspire.Hosting.Azure.Tests (4)
Aspire.Hosting.Elasticsearch.Tests (6)
Aspire.Hosting.Garnet.Tests (7)
Aspire.Hosting.Kafka.Tests (9)
Aspire.Hosting.Keycloak.Tests (10)
Aspire.Hosting.Milvus.Tests (12)
Aspire.Hosting.MongoDB.Tests (18)
Aspire.Hosting.MySql.Tests (15)
Aspire.Hosting.Nats.Tests (8)
Aspire.Hosting.NodeJs.Tests (10)
Aspire.Hosting.Oracle.Tests (2)
Aspire.Hosting.PostgreSQL.Tests (19)
Aspire.Hosting.Python.Tests (14)
Aspire.Hosting.Qdrant.Tests (9)
Aspire.Hosting.RabbitMQ.Tests (12)
Aspire.Hosting.Redis.Tests (12)
Aspire.Hosting.SqlServer.Tests (14)
Aspire.Hosting.Testing.Tests (1)
Aspire.Hosting.Tests (9)
Aspire.Keycloak.Authentication.Tests (4)
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (2)
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (2)
Aspire.OpenAI.Tests (1)
Aspire.Oracle.EntityFrameworkCore.Tests (2)
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (2)
IIS.Tests (1)
InMemory.FunctionalTests (19)
Microsoft.AspNetCore.Antiforgery.Test (1)
Microsoft.AspNetCore.AsyncState.Tests (2)
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 (10)
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (2)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (13)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (6)
Microsoft.AspNetCore.HeaderParsing.Tests (2)
Microsoft.AspNetCore.Hosting.Tests (15)
Microsoft.AspNetCore.Http.Abstractions.Tests (28)
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 (9)
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.WebSockets.Tests (1)
Microsoft.AspNetCore.WebUtilities.Tests (2)
Microsoft.Build.Engine.UnitTests (24)
Evaluation\Expander_Tests.cs (8)
2655Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Microsoft.FOO.FileIO.FileSystem]::CurrentDirectory)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2656Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.Baz]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2657Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2658Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2659Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2660Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
2661Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance));
3345var ex = Assert.Throws<InvalidProjectFileException>(
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (17)
CodeGen\CodeGenTupleTest.cs (16)
5791Assert.Throws<ArgumentNullException>(() => comp.CreateTupleTypeSymbol(null, default(ImmutableArray<string>)));
6213Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType: vt2));
6216Assert.Throws<ArgumentNullException>(() => comp.CreateErrorTypeSymbol(null, null, 2));
6217Assert.Throws<ArgumentException>(() => comp.CreateErrorTypeSymbol(null, "a", -1));
6218Assert.Throws<ArgumentException>(() => comp.CreateErrorTypeSymbol(vbComp.GlobalNamespace, "a", 1));
6220Assert.Throws<ArgumentNullException>(() => comp.CreateErrorNamespaceSymbol(null, "a"));
6221Assert.Throws<ArgumentNullException>(() => comp.CreateErrorNamespaceSymbol(vbComp.GlobalNamespace, null));
6222Assert.Throws<ArgumentException>(() => comp.CreateErrorNamespaceSymbol(vbComp.GlobalNamespace, "a"));
6314var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(vbType, default(ImmutableArray<string>)));
6331var e = Assert.Throws<ArgumentException>(() => comp.CreateAnonymousTypeSymbol(ImmutableArray.Create(vbType), ImmutableArray.Create("m1")));
6341Assert.Throws<ArgumentNullException>(() => comp.CreateTupleTypeSymbol(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<string>)));
6344Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(ImmutableArray<ITypeSymbol>.Empty, default(ImmutableArray<string>)));
6586Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, vbType), default(ImmutableArray<string>)));
6802var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty));
6842var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: CreateAnnotations(CodeAnalysis.NullableAnnotation.NotAnnotated, 8)));
10959Assert.Throws<ArgumentNullException>(() => Compilation.GetRequiredLanguageVersion(null));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (20)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (20)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (17)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (23)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (123)
Compilation\CompilationAPITests.cs (68)
389Assert.Throws<ArgumentException>(() => c.Emit(peStream));
390Assert.Throws<ArgumentException>(() => c.Emit(new MemoryStream(), pdbStream));
819Assert.Throws<ArgumentException>(() => comp.AddSyntaxTrees(t1));
822Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(t1, comp.SyntaxTrees[0]));
825Assert.Throws<ArgumentException>(() => comp = comp.RemoveSyntaxTrees(SyntaxFactory.ParseSyntaxTree(s1)));
829Assert.Throws<ArgumentException>(() => comp = comp.RemoveSyntaxTrees(withErrorTree));
857Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t5).RemoveSyntaxTrees(col));
868Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t6).RemoveSyntaxTrees(stack));
879Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t6).RemoveSyntaxTrees(queue));
914Assert.Throws<ArgumentException>(() => CSharpCompilation.Create("Compilation", new SyntaxTree[] { withExpressionRootTree }));
917Assert.Throws<ArgumentException>(() => comp.AddSyntaxTrees(withExpressionRootTree));
920Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(comp.SyntaxTrees[0], withExpressionRootTree));
957Assert.Throws<ArgumentException>(() => comp = comp.AddSyntaxTrees(listSyntaxTree).AddReferences().ReplaceSyntaxTree(t1, t2));
1297Assert.Throws<ArgumentException>(() => comp.AddReferences(compRef));
1341Assert.Throws<ArgumentNullException>(() => CSharpCompilation.Create("goo", syntaxTrees: new SyntaxTree[] { null }));
1342Assert.Throws<ArgumentNullException>(() => CSharpCompilation.Create("goo", references: new MetadataReference[] { null }));
1382Assert.Throws<ArgumentException>(() => comp.AddReferences(compRef));
1428Assert.Throws<ArgumentException>(() => comp.AddReferences(listRef).AddReferences(ref2).RemoveReferences(ref1, ref2, ref3, ref4).ReplaceReference(ref2, ref2));
1438Assert.Throws<ArgumentException>(() => comp = comp.RemoveReferences(ref1));
1443Assert.Throws<ArgumentException>(() => comp = comp.ReplaceReference(MscorlibRef, ref1));
1489Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(newTree: SyntaxFactory.ParseSyntaxTree("Using System;"), oldTree: t1));
1556Assert.Throws<ArgumentException>(() => (comp.AddSyntaxTrees(t1, t1)));
2400Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: genericParameter));
2401Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: open));
2402Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: typeof(void)));
2403Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: byref));
2405Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: genericParameter));
2406Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: open));
2407Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: typeof(void)));
2408Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: typeof(int)));
2409Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: ptr));
2410Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: byref));
2413Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a1", previousScriptCompilation: s0, globalsType: typeof(List<bool>)));
2416Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseExe));
2417Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.NetModule)));
2418Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeMetadata)));
2419Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeApplication)));
2420Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsApplication)));
2421Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithCryptoKeyContainer("goo")));
2422Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithCryptoKeyFile("goo.snk")));
2423Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithDelaySign(true)));
2424Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithDelaySign(false)));
2453Assert.Throws<InvalidOperationException>(() => CreateSubmission("a + 1", previous: s0));
2468Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, default));
2469Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, 0));
2476Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, rank: default));
2477Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, rank: 0));
2508Assert.Throws<ArgumentException>(() =>
2518Assert.Throws<ArgumentException>(() =>
2530Assert.Throws<ArgumentException>(() =>
2542Assert.Throws<ArgumentException>(() =>
2554Assert.Throws<ArgumentNullException>(() =>
2566Assert.Throws<ArgumentNullException>(() =>
2576Assert.Throws<ArgumentNullException>(() =>
2586Assert.Throws<ArgumentNullException>(() =>
2596Assert.Throws<ArgumentNullException>(() =>
2705Assert.Throws<ArgumentException>(() => comp.CreateAnonymousTypeSymbol(memberTypes, memberNames, memberNullableAnnotations: ImmutableArray.Create(CodeAnalysis.NullableAnnotation.NotAnnotated)));
2771Assert.Throws<ArgumentException>(() =>
3034Assert.Throws<ArgumentException>(() => genericType.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>)));
3035Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments: default, typeArgumentNullableAnnotations: default));
3042Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty));
3043Assert.Throws<ArgumentException>(() => genericType.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default));
3053Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments, default));
3069Assert.Throws<ArgumentException>(() => genericMethod.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>)));
3070Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments: default, typeArgumentNullableAnnotations: default));
3077Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty));
3078Assert.Throws<ArgumentException>(() => genericMethod.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default));
3088Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments, default));
Compilation\SemanticModelAPITests.cs (9)
2181Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, statement: null, speculativeModel: out speculativeModel));
2182Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, constructorInitializer: (ConstructorInitializerSyntax)null, speculativeModel: out speculativeModel));
2183Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, attribute: null, speculativeModel: out speculativeModel));
2186Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, statement: statement, speculativeModel: out speculativeModel));
2187Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(ctorInitializer.SpanStart, constructorInitializer: ctorInitializer, speculativeModel: out speculativeModel));
2188Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(attribute.SpanStart, attribute: attribute, speculativeModel: out speculativeModel));
2193Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, speculatedStatement, speculativeModel: out speculativeModel));
2235Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, newSpeculatedStatement, out newModel));
2239Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, newSpeculatedStatement, out newModel));
Symbols\FunctionPointerTypeSymbolTests.cs (9)
1537Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray.Create(RefKind.None)));
1538Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.Out, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty));
1539Assert.Throws<ArgumentOutOfRangeException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: (SignatureCallingConvention)10));
1540Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Default, callingConventionTypes: ImmutableArray.Create(cdeclType)!));
1541Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.StdCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!));
1542Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.FastCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!));
1543Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.CDecl, callingConventionTypes: ImmutableArray.Create(cdeclType)!));
1544Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.ThisCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!));
1545Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, callingConventionTypes: ImmutableArray.Create(@string)!));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (101)
Syntax\SyntaxFactoryTests.cs (4)
103Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(SyntaxKind.NumericLiteralExpression));
141Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList)));
142Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList)));
143Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList)));
Syntax\SyntaxNodeTests.cs (20)
751Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(EOFSpan));
761Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(nodeEndPositionSpan));
765Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan));
767Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan));
769Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan));
771Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan));
773Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(root.FullSpan));
2156Assert.Throws<InvalidOperationException>(() => ifstatement.ReplaceNode(then, new[] { stat1, stat2 }));
2159Assert.Throws<InvalidOperationException>(() => ifstatement.ReplaceNode(then, new StatementSyntax[] { }));
2196Assert.Throws<InvalidOperationException>(() => ifstatement.InsertNodesBefore(then, new[] { stat1, stat2 }));
2199Assert.Throws<InvalidOperationException>(() => ifstatement.InsertNodesAfter(then, new StatementSyntax[] { }));
2297Assert.Throws<InvalidOperationException>(() => cu.ReplaceToken(identifierC, new[] { identifierA, identifierB }));
2300Assert.Throws<InvalidOperationException>(() => cu.ReplaceToken(identifierC, new SyntaxToken[] { }));
2328Assert.Throws<InvalidOperationException>(() => cu.InsertTokensBefore(identifierC, new[] { identifierA, identifierB }));
2331Assert.Throws<InvalidOperationException>(() => cu.InsertTokensAfter(identifierC, new[] { identifierA, identifierB }));
3522Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken }));
3523Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken }));
3524Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, intType }));
3711Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChanges(BlankTree));
3744Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChangedSpans(BlankTree));
Syntax\SyntaxTriviaListTests.cs (22)
169Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, triviaD));
170Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(list.Count + 1, triviaD));
171Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { triviaD }));
172Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(list.Count + 1, new[] { triviaD }));
173Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(-1));
174Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(list.Count));
175Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxTrivia)));
176Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxTrivia)));
177Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxTrivia>)null));
178Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxTrivia>)null));
179Assert.Throws<ArgumentNullException>(() => list.ReplaceRange(elementA, (IEnumerable<SyntaxTrivia>)null));
216Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0));
217Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, triviaD));
218Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, triviaD));
219Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(1, new[] { triviaD }));
220Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { triviaD }));
221Assert.Throws<ArgumentOutOfRangeException>(() => list.Replace(triviaD, triviaE));
222Assert.Throws<ArgumentOutOfRangeException>(() => list.ReplaceRange(triviaD, new[] { triviaE }));
223Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxTrivia)));
224Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxTrivia)));
225Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxTrivia>)null));
226Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxTrivia>)null));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (5)
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (14)
Microsoft.CodeAnalysis.Test.Utilities (4)
Microsoft.CodeAnalysis.UnitTests (233)
Collections\IndexOfTests.cs (17)
33Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default));
34Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default));
35Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default));
36Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default));
37Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, new CustomComparer(50)));
38Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, new CustomComparer(50)));
39Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, 20, new CustomComparer(1)));
40Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, -1, new CustomComparer(1)));
102Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default));
103Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default));
104Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default));
105Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default));
106Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, new CustomComparer(50)));
107Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, new CustomComparer(50)));
108Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, 20, new CustomComparer(1)));
109Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, -1, new CustomComparer(1)));
110Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndex(collection1256, 2, 5));
Emit\CustomDebugInfoTests.cs (5)
154var e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff }), ImmutableArray<byte>.Empty));
157e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
160e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
171e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(largeData), ImmutableArray<byte>.Empty));
337Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(
Emit\EmitBaselineTests.cs (4)
33Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(null, peModule, debugInfoProvider, localSigProvider, true));
34Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, null, debugInfoProvider, localSigProvider, true));
35Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, peModule, null, localSigProvider, true));
36Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, mdModule, debugInfoProvider, null, true));
IsSymbolAccessibleWithinTests.cs (8)
34Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Av, Av));
35Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Av, Ac));
36Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Ac, Av));
37Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Ac, Ac, Av));
39Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Ac, Ac));
40Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Ac, Av));
41Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Av, Ac));
42Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Av, Av, Ac));
ResourceDescriptionTests.cs (17)
28Assert.Throws<ArgumentNullException>(() => new ResourceDescription(null, "file", data, isPublic: true));
29Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", null, data, isPublic: true));
30Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", "file", null, isPublic: true));
31Assert.Throws<ArgumentNullException>(() => new ResourceDescription(null, data, isPublic: true));
32Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", null, isPublic: true));
35Assert.Throws<ArgumentException>(() => new ResourceDescription("", "file", data, isPublic: true));
36Assert.Throws<ArgumentException>(() => new ResourceDescription("res", "", data, isPublic: true));
37Assert.Throws<ArgumentException>(() => new ResourceDescription("res", "", data, isPublic: true));
38Assert.Throws<ArgumentException>(() => new ResourceDescription("", "file", data, isPublic: true));
41Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x/x", data, isPublic: true));
42Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x\\x", data, isPublic: true));
43Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x:x", data, isPublic: true));
44Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "\0", data, isPublic: true));
45Assert.Throws<ArgumentException>(() => new ResourceDescription("", "x", data, isPublic: true));
46Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx\0xxxx", "", data, isPublic: true));
47Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx\uD800asdas", "", data, isPublic: true));
48Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx", "xxx\uD800asdas", data, isPublic: true));
Text\StringText_LineTest.cs (7)
62Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 0)));
69Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 3)));
76Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 5)));
107Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 10)));
114Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(-1, 2)));
121Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(7, 0)));
128Assert.Throws<ArgumentNullException>(() => TextLine.FromSpan(null, new TextSpan(0, 2)));
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (5)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (25)
Syntax\SeparatedSyntaxListTests.vb (24)
138Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(-1, nodeD))
139Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(list.Count + 1, nodeD))
140Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(-1, {nodeD}))
141Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(list.Count + 1, {nodeD}))
142Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(-1))
143Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(list.Count))
144Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Replace(nodeD, nodeE))
145Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.ReplaceRange(nodeD, {nodeE}))
146Assert.Throws(Of ArgumentNullException)(Function() list.Add(Nothing))
147Assert.Throws(Of ArgumentNullException)(Function() list.AddRange(DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
148Assert.Throws(Of ArgumentNullException)(Function() list.Insert(0, Nothing))
149Assert.Throws(Of ArgumentNullException)(Function() list.InsertRange(0, DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
150Assert.Throws(Of ArgumentNullException)(Function() list.ReplaceRange(elementA, DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
185Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(0))
186Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(1, nodeD))
187Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(-1, nodeD))
188Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(1, {nodeD}))
189Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(-1, {nodeD}))
190Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Replace(nodeD, nodeE))
191Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.ReplaceRange(nodeD, {nodeE}))
192Assert.Throws(Of ArgumentNullException)(Function() list.Add(Nothing))
193Assert.Throws(Of ArgumentNullException)(Function() list.AddRange(DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
194Assert.Throws(Of ArgumentNullException)(Function() list.Insert(0, Nothing))
195Assert.Throws(Of ArgumentNullException)(Function() list.InsertRange(0, DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
Microsoft.CodeAnalysis.Workspaces.UnitTests (102)
Options\OptionKeyTests.cs (9)
23Assert.Throws<ArgumentNullException>(() => new Option<bool>("Test Feature", null!, false));
24Assert.Throws<ArgumentNullException>(() => new Option<bool>(null!, "Test Name", false));
25Assert.Throws<ArgumentNullException>(() => new Option<bool>("X", "Test Name", false, storageLocations: null!));
32Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>("Test Feature", null!, false));
33Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>(null!, "Test Name", false));
34Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>("X", "Test Name", false, storageLocations: null!));
70Assert.Throws<ArgumentNullException>(() => new OptionKey(null!));
71Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, null!));
72Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, "lang"));
SolutionTests\ProjectInfoTests.cs (4)
25Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(id: null, version: VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: "C#"));
26Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: null, assemblyName: "Bar", language: "C#"));
27Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: null, language: "C#"));
28Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: null));
SolutionTests\SolutionTests.cs (71)
118Assert.Throws<ArgumentNullException>(() => solution.RemoveDocument(null!));
119Assert.Throws<InvalidOperationException>(() => solution.RemoveDocument(s_unrelatedDocumentId));
127Assert.Throws<ArgumentNullException>(() => solution.RemoveDocuments(default));
128Assert.Throws<InvalidOperationException>(() => solution.RemoveDocuments(ImmutableArray.Create(s_unrelatedDocumentId)));
129Assert.Throws<ArgumentNullException>(() => solution.RemoveDocuments(ImmutableArray.Create((DocumentId)null!)));
137Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocument(null!));
138Assert.Throws<InvalidOperationException>(() => solution.RemoveAdditionalDocument(s_unrelatedDocumentId));
146Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocuments(default));
147Assert.Throws<InvalidOperationException>(() => solution.RemoveAdditionalDocuments(ImmutableArray.Create(s_unrelatedDocumentId)));
148Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocuments(ImmutableArray.Create((DocumentId)null!)));
156Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocument(null!));
157Assert.Throws<InvalidOperationException>(() => solution.RemoveAnalyzerConfigDocument(s_unrelatedDocumentId));
165Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocuments(default));
166Assert.Throws<InvalidOperationException>(() => solution.RemoveAnalyzerConfigDocuments(ImmutableArray.Create(s_unrelatedDocumentId)));
167Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocuments(ImmutableArray.Create((DocumentId)null!)));
184Assert.Throws<ArgumentNullException>(() => solution.WithDocumentName(documentId, name: null!));
186Assert.Throws<ArgumentNullException>(() => solution.WithDocumentName(null!, name));
187Assert.Throws<InvalidOperationException>(() => solution.WithDocumentName(s_unrelatedDocumentId, name));
216Assert.Throws<ArgumentNullException>(() => solution.WithDocumentFolders(null!, folders));
217Assert.Throws<InvalidOperationException>(() => solution.WithDocumentFolders(s_unrelatedDocumentId, folders));
244Assert.Throws<ArgumentNullException>(() => solution.WithDocumentFilePath(null!, path));
245Assert.Throws<InvalidOperationException>(() => solution.WithDocumentFilePath(s_unrelatedDocumentId, path));
260Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentSourceCodeKind(documentId, (SourceCodeKind)(-1)));
262Assert.Throws<ArgumentNullException>(() => solution.WithDocumentSourceCodeKind(null!, SourceCodeKind.Script));
263Assert.Throws<InvalidOperationException>(() => solution.WithDocumentSourceCodeKind(s_unrelatedDocumentId, SourceCodeKind.Script));
319Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentSyntaxRoot(documentId, root, (PreservationMode)(-1)));
321Assert.Throws<ArgumentNullException>(() => solution.WithDocumentSyntaxRoot(null!, root));
322Assert.Throws<InvalidOperationException>(() => solution.WithDocumentSyntaxRoot(s_unrelatedDocumentId, root));
340Assert.Throws<ArgumentException>(() => provider.TryGetDiagnosticValue(tree, "CA1234", CancellationToken.None, out _));
361Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity));
362Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentText(documentId, text, (PreservationMode)(-1)));
364Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity));
365Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity));
385Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity));
386Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentText(documentId, textAndVersion, (PreservationMode)(-1)));
388Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity));
389Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity));
929Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity));
930Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithAdditionalDocumentText(documentId, text, (PreservationMode)(-1)));
932Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity));
933Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity));
953Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity));
954Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithAdditionalDocumentText(documentId, textAndVersion, (PreservationMode)(-1)));
956Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity));
957Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity));
978Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity));
979Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity));
1002Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity));
1003Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity));
1021Assert.Throws<ArgumentNullException>(() => solution.WithDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity));
1043Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity));
1451Assert.Throws<InvalidOperationException>(() => solution.WithProjectAssemblyName(ProjectId.CreateNewId(), "x.dll"));
1475Assert.Throws<InvalidOperationException>(() => solution.WithProjectOutputFilePath(ProjectId.CreateNewId(), "x.dll"));
1529Assert.Throws<InvalidOperationException>(() => solution.WithProjectOutputRefFilePath(ProjectId.CreateNewId(), "x.dll"));
1552Assert.Throws<InvalidOperationException>(() => solution.WithProjectCompilationOutputInfo(ProjectId.CreateNewId(), info));
1575Assert.Throws<InvalidOperationException>(() => solution.WithProjectDefaultNamespace(ProjectId.CreateNewId(), "x"));
1689Assert.Throws<InvalidOperationException>(() => solution.WithProjectName(ProjectId.CreateNewId(), "x"));
1712Assert.Throws<InvalidOperationException>(() => solution.WithProjectFilePath(ProjectId.CreateNewId(), "x"));
1728Assert.Throws<InvalidOperationException>(() => solution.WithProjectCompilationOptions(ProjectId.CreateNewId(), options));
1777Assert.Throws<InvalidOperationException>(() => solution.WithProjectParseOptions(ProjectId.CreateNewId(), options));
2032Assert.Throws<InvalidOperationException>(() => solution.RemoveProjectReference(ProjectId.CreateNewId(), projectRef2));
2135Assert.Throws<InvalidOperationException>(() => solution.RemoveMetadataReference(projectId, new TestMetadataReference()));
2138Assert.Throws<InvalidOperationException>(() => solution.RemoveMetadataReference(ProjectId.CreateNewId(), metadataRef1));
2409Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", "text"));
2437Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", sourceText));
2466Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", syntaxRoot: root));
2740Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveDocuments(ImmutableArray.Create(documentInfo1.Id)));
2759Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveAdditionalDocuments(ImmutableArray.Create(documentInfo1.Id)));
2778Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveAnalyzerConfigDocuments(ImmutableArray.Create(documentInfo1.Id)));
4661Assert.Throws<ArgumentException>(() => solution = solution.WithProjectDocumentsOrder(pid, ImmutableList.Create<DocumentId>()));
4662Assert.Throws<ArgumentNullException>(() => solution = solution.WithProjectDocumentsOrder(pid, null));
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (1)
Microsoft.Data.Analysis.Tests (141)
Microsoft.DotNet.XUnitAssert.Tests (7)
Microsoft.Extensions.AmbientMetadata.Application.Tests (7)
Microsoft.Extensions.AsyncState.Tests (1)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Compliance.Abstractions.Tests (3)
Microsoft.Extensions.Compliance.Redaction.Tests (3)
Microsoft.Extensions.Compliance.Testing.Tests (12)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (4)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (9)
SystemResourcesTests.cs (4)
29Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(0.0, 1.0, 1000UL, 1000UL));
31Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 0.0, 1000UL, 1000UL));
34Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 1.0, 0UL, 1000UL));
36Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 1.0, 1000UL, 0UL));
Microsoft.Extensions.Diagnostics.Testing.Tests (16)
Metrics\MetricCollectorTests.cs (12)
19Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>((Instrument<long>)null!));
20Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>((ObservableInstrument<long>)null!));
21Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(new Meter(Guid.NewGuid().ToString()), null!));
22Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(null!, "Hello"));
23Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(null, null!, "Hello"));
25Assert.Throws<ArgumentException>(() => new MetricCollector<long>(new Meter(Guid.NewGuid().ToString()), string.Empty));
26Assert.Throws<ArgumentException>(() => new MetricCollector<long>(null, string.Empty, "Hello"));
27Assert.Throws<ArgumentException>(() => new MetricCollector<long>(null, "Hello", string.Empty));
36Assert.Throws<InvalidOperationException>(() => new MetricCollector<Guid>(meter, "Counter"));
37Assert.Throws<InvalidOperationException>(() => new MetricCollector<Guid>(null, meter.Name, "Counter"));
361Assert.Throws<ObjectDisposedException>(() => collector.GetMeasurementSnapshot());
363Assert.Throws<ObjectDisposedException>(() => collector.LastMeasurement);
Microsoft.Extensions.Features.Tests (2)
Microsoft.Extensions.FileProviders.Embedded.Tests (1)
Microsoft.Extensions.Hosting.Testing.Tests (3)
Microsoft.Extensions.Http.Resilience.Tests (17)
Resilience\HttpClientBuilderExtensionsTests.Resilience.cs (8)
31Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler(null!, _ => { }));
32Assert.Throws<ArgumentException>(() => builder.AddResilienceHandler(string.Empty, _ => { }));
33Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler(null!, (_, _) => { }));
34Assert.Throws<ArgumentException>(() => builder.AddResilienceHandler(string.Empty, (_, _) => { }));
35Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler("dummy", (Action<ResiliencePipelineBuilder<HttpResponseMessage>>)null!));
36Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler("dummy", (Action<ResiliencePipelineBuilder<HttpResponseMessage>, ResilienceHandlerContext>)null!));
39Assert.Throws<ArgumentNullException>(() => builder!.AddResilienceHandler("pipeline-name", _ => { }));
40Assert.Throws<ArgumentNullException>(() => builder!.AddResilienceHandler("pipeline-name", (_, _) => { }));
Microsoft.Extensions.Localization.Tests (4)
Microsoft.Extensions.ML.Tests (4)
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (5)
Microsoft.Extensions.ObjectPool.Tests (1)
Microsoft.Extensions.Options.Contextual.Tests (1)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (6)
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (3)
Microsoft.Extensions.Telemetry.Abstractions.Tests (18)
Microsoft.Extensions.Telemetry.Tests (18)
Microsoft.JSInterop.Tests (23)
Infrastructure\DotNetDispatcherTest.cs (6)
169var ex = Assert.Throws<InvalidOperationException>(() =>
238var ex = Assert.Throws<ArgumentException>(
257var ex = Assert.Throws<ArgumentException>(
506var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, 0, default), "[7]"));
521var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(null, methodIdentifier, 1, default), argsJson));
535Assert.Throws<JsonException>(() =>
Microsoft.ML.AutoML.Tests (1)
Microsoft.ML.OnnxTransformerTest (1)
Microsoft.ML.Tests (23)
ImagesTests.cs (16)
1264Assert.Throws<ArgumentNullException>(() => MLImage.CreateFromFile(null));
1265Assert.Throws<ArgumentException>(() => MLImage.CreateFromFile("This is Invalid Path"));
1266Assert.Throws<ArgumentNullException>(() => MLImage.CreateFromStream(null));
1267Assert.Throws<ArgumentException>(() => MLImage.CreateFromStream(new MemoryStream(new byte[10])));
1268Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Unknown, Array.Empty<byte>()));
1269Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Bgra32, Array.Empty<byte>()));
1270Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(0, 10, MLPixelFormat.Bgra32, new byte[10]));
1271Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 0, MLPixelFormat.Bgra32, new byte[10]));
1272Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Bgra32, new byte[401]));
1319Assert.Throws<InvalidOperationException>(() => image.Tag);
1320Assert.Throws<InvalidOperationException>(() => image.Tag = "Something");
1321Assert.Throws<InvalidOperationException>(() => image.Width);
1322Assert.Throws<InvalidOperationException>(() => image.Height);
1323Assert.Throws<InvalidOperationException>(() => image.PixelFormat);
1324Assert.Throws<InvalidOperationException>(() => image.BitsPerPixel);
1325Assert.Throws<InvalidOperationException>(() => image.Pixels[0]);
Microsoft.ML.Tokenizers.Tests (11)
TokenizerTests.cs (4)
221Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCount(input, maxTokenCount: 0, out _, out _));
222Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCount(input, maxTokenCount: -1, out _, out _));
223Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCountFromEnd(input, maxTokenCount: 0, out _, out _));
224Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCountFromEnd(input, maxTokenCount: -1, out _, out _));
Microsoft.Net.Http.Headers.Tests (76)
Microsoft.VisualBasic.IntegrationTests (2)
Microsoft.VisualBasic.Tests (9)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (68)
PresentationCore.Tests (1)
Shared.Tests (12)
Data.Validation\LengthAttributeTests.cs (5)
343Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options0, context, results, true));
348Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options1, context, results, true));
353Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options2, context, results, true));
358Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options3, context, results, true));
363Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options4, context, results, true));
Sockets.FunctionalTests (2)
System.Drawing.Common.Tests (243)
mono\System.Drawing\GraphicsTests.cs (7)
426Assert.Throws<ArgumentException>(() => g.Transform = matrix);
1596Assert.Throws<ArgumentNullException>(() => g.MeasureString("a", null));
1597Assert.Throws<ArgumentNullException>(() => g.MeasureString("a".AsSpan(), null));
1884Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a", null, default, null));
1885Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a".AsSpan(), null, default, null));
2000Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono", _font, default, null));
2001Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono".AsSpan(), _font, default, null));
System\Drawing\BitmapTests.cs (13)
314Assert.Throws<NullReferenceException>(() => new Bitmap((Image)null));
440Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(x, y, width, height), bitmap.PixelFormat));
441Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(x, y, width, height), bitmap.PixelFormat));
456Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(0, 0, 1, 1), format));
457Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(0, 0, 1, 1), format));
464Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(0, 0, 1, 1), PixelFormat.Format32bppArgb));
465Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(0, 0, 1, 1), PixelFormat.Format32bppArgb));
655Assert.Throws<ExternalException>(() => Image.FromHbitmap(IntPtr.Zero));
1188Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat));
1189Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat, new BitmapData()));
1191Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat));
1192Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat, new BitmapData()));
1447Assert.Throws<NullReferenceException>(() => bitmap.Palette = null);
System\Drawing\Drawing2D\LinearGradientBrushTests.cs (8)
69Assert.Throws<OutOfMemoryException>(() => new LinearGradientBrush(new Point(x, y), new Point(x, y), Color.Fuchsia, Color.GhostWhite));
70Assert.Throws<OutOfMemoryException>(() => new LinearGradientBrush(new PointF(x, y), new PointF(x, y), Color.Fuchsia, Color.GhostWhite));
312Assert.Throws<ArgumentNullException>(() => brush.Blend = null);
319Assert.Throws<ArgumentNullException>(() => brush.Blend = new Blend { Factors = null });
419Assert.Throws<NullReferenceException>(() => brush.InterpolationColors = new ColorBlend { Colors = null });
437Assert.Throws<ArgumentException>(() => brush.InterpolationColors = new ColorBlend { Colors = new Color[2], Positions = null });
543Assert.Throws<NullReferenceException>(() => brush.LinearColors = null);
552Assert.Throws<IndexOutOfRangeException>(() => brush.LinearColors = new Color[length]);
System\Drawing\Drawing2D\MatrixTests.cs (4)
147Assert.Throws<OutOfMemoryException>(() => new Matrix(new Rectangle(1, 1, 0, 1), new Point[3]));
148Assert.Throws<OutOfMemoryException>(() => new Matrix(new RectangleF(1, 1, 0, 1), new PointF[3]));
154Assert.Throws<OutOfMemoryException>(() => new Matrix(new Rectangle(1, 1, 1, 0), new Point[3]));
155Assert.Throws<OutOfMemoryException>(() => new Matrix(new RectangleF(1, 1, 1, 0), new PointF[3]));
System\Drawing\IconConverterTests.cs (26)
112Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom("System.Drawing.String"));
113Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
114Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20)));
115Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10)));
116Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10)));
117Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
124Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom("System.Drawing.String"));
125Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
126Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20)));
127Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10)));
128Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10)));
129Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
144Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Rectangle)));
145Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, _icon.GetType()));
146Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Size)));
147Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Point)));
148Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Metafile)));
149Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(object)));
150Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(int)));
161Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Rectangle)));
162Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, _icon.GetType()));
163Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Size)));
164Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Point)));
165Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Metafile)));
166Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(object)));
167Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(int)));
System\Drawing\ImageConverterTests.cs (28)
139Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom("System.Drawing.String"));
140Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
141Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20)));
142Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10)));
143Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10)));
144Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
146Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom("System.Drawing.String"));
147Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
148Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20)));
149Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10)));
150Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10)));
151Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
197Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Rectangle)));
198Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, _image.GetType()));
199Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Size)));
200Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Bitmap)));
201Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Point)));
202Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Metafile)));
203Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(object)));
204Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(int)));
206Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Rectangle)));
207Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, _image.GetType()));
208Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Size)));
209Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Bitmap)));
210Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Point)));
211Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Metafile)));
212Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(object)));
213Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(int)));
System\Drawing\ImageFormatConverterTests.cs (22)
72Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp));
73Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid));
74Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
75Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, 10));
77Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp));
78Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid));
79Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object()));
80Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, 10));
118Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("System.Drawing.String"));
119Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
120Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]"));
122Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("System.Drawing.String"));
123Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String"));
124Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]"));
146Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat)));
147Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(Guid)));
148Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(object)));
149Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(int)));
151Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat)));
152Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(Guid)));
153Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(object)));
154Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(int)));
System\Drawing\Imaging\EncoderParameterTests.cs (15)
210Assert.Throws<InvalidOperationException>(() => new EncoderParameter(s_anyEncoder, 1, (EncoderParameterValueType)999, IntPtr.Zero));
229Assert.Throws<NullReferenceException>(() => ep.Encoder = null);
255Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (string)null));
261Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (byte[])null));
287Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0));
288Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, false));
289Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, (short)0));
290Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, numerator: 0, denominator: 0));
291Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, rangebegin: 0, rangeend: 0));
292Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, 0, 0, 0));
293Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, "anyString"));
294Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<byte>()));
296Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<short>()));
297Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<long>()));
322Assert.Throws<OutOfMemoryException>(() => new EncoderParameter(s_anyEncoder, numberOfValues, anyType, anyValue));
System\Drawing\Imaging\MetafileTests.cs (16)
47Assert.Throws<ExternalException>(() => new Metafile(metafile.GetHenhmetafile(), false));
60Assert.Throws<ExternalException>(() => new Metafile(GetPath(BmpFile)));
72Assert.Throws<ExternalException>(() => new Metafile("fileNotExist"));
108Assert.Throws<ExternalException>(() => new Metafile(stream));
436Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc));
437Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly));
438Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly, "description"));
711Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, _rectangleF));
712Assert.Throws<PathTooLongException>(() =>
714Assert.Throws<PathTooLongException>(() =>
716Assert.Throws<PathTooLongException>(() =>
827Assert.Throws<ArgumentNullException>(() => new Metafile((Stream)null, referenceHdc, _rectangleF));
828Assert.Throws<ArgumentNullException>(() => new Metafile((Stream)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible));
829Assert.Throws<ArgumentNullException>(() =>
831Assert.Throws<ArgumentNullException>(() =>
875Assert.Throws<ArgumentNullException>(() => Metafile.GetMetafileHeader((Stream)null));
System\Drawing\Printing\MarginsConverterTests.cs (7)
56Assert.Throws<ArgumentException>(() => mc.CreateInstance(context, values));
109Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, null, null));
110Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, culture, null));
111Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, culture, Guid.NewGuid()));
139Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, new object(), typeof(object)));
140Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, 12, typeof(int)));
141Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, guid, typeof(Guid)));
System\Drawing\TextureBrushTests.cs (6)
291Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle));
292Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle));
293Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, rectangle));
294Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, (RectangleF)rectangle));
295Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle, null));
296Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle, null));
System.ServiceModel.Http.Tests (30)
System.ServiceModel.NetTcp.Tests (9)
System.ServiceModel.Primitives.Tests (27)
System.ServiceModel.UnixDomainSocket.Tests (5)
System.Windows.Forms.Design.Tests (73)
System.Windows.Forms.Primitives.Tests (3)
System.Windows.Forms.Primitives.TestUtilities (2)
System.Windows.Forms.Tests (623)
System.Xaml.Tests (37)
System\Windows\Markup\NameReferenceConverterTests.cs (5)
85Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, "name"));
100Assert.Throws<InvalidCastException>(() => converter.ConvertFrom(context, null, "name"));
118Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, value));
177Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(context, null, "value", null));
192Assert.Throws<InvalidCastException>(() => converter.ConvertTo(context, null, "value", null));
WindowsBase.Tests (7)
xunit.assert (1)