1940 references to Throws
Aspire.Azure.AI.OpenAI.Tests (5)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (2)
122var ex = Assert.Throws<InvalidOperationException>(() => 153var ex = Assert.Throws<InvalidOperationException>(() =>
AspireAzureOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (2)
122var ex = Assert.Throws<InvalidOperationException>(() => 153var ex = Assert.Throws<InvalidOperationException>(() =>
AspireConfigurableOpenAIExtensionsTests.cs (1)
25Assert.Throws<InvalidOperationException>(() =>
Aspire.Azure.Messaging.WebPubSub.Tests (1)
AspireWebPubSubExtensionsTests.cs (1)
163Assert.Throws<ArgumentException>(() => builder.AddKeyedAzureWebPubSubServiceClient("wps", ""));
Aspire.Elastic.Clients.Elasticsearch.Tests (6)
ElasticsearchClientPublicApiTests.cs (6)
20var exception = Assert.Throws<ArgumentNullException>(action); 33var exception = Assert.Throws<ArgumentNullException>(action); 46var exception = Assert.Throws<ArgumentException>(action); 59var exception = Assert.Throws<ArgumentNullException>(action); 72var exception = Assert.Throws<ArgumentNullException>(action); 85var exception = Assert.Throws<ArgumentException>(action);
Aspire.Hosting.Azure.Tests (1)
AzureBicepProvisionerTests.cs (1)
109Assert.Throws<ArgumentException>(() =>
Aspire.Hosting.Containers.Tests (9)
WithDockerfileTests.cs (9)
486var ex = Assert.Throws<ArgumentException>(() => 500var ex = Assert.Throws<ArgumentException>(() => 515var ex = Assert.Throws<DirectoryNotFoundException>(() => 528var ex = Assert.Throws<DirectoryNotFoundException>(() => 540var ex = Assert.Throws<FileNotFoundException>(() => 555var ex = Assert.Throws<FileNotFoundException>(() => 569var ex = Assert.Throws<FileNotFoundException>(() => 584var ex = Assert.Throws<FileNotFoundException>(() => 598var ex = Assert.Throws<InvalidOperationException>(() =>
Aspire.Hosting.Tests (5)
DistributedApplicationTests.cs (1)
124var ex = Assert.Throws<AggregateException>(testProgram.Run);
ProjectResourceTests.cs (1)
23var ex = Assert.Throws<DistributedApplicationException>(() =>
WithEndpointTests.cs (3)
159var ex = Assert.Throws<DistributedApplicationException>(() => 174var ex = Assert.Throws<DistributedApplicationException>(() => 189var ex = Assert.Throws<DistributedApplicationException>(() =>
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (2)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (1)
173var exception = Assert.Throws<InvalidOperationException>(() => builder.AddCosmosDbContext<TestDbContext>("cosmos", "databaseName"));
EnrichCosmosDbTests.cs (1)
32var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichCosmosDbContext<TestDbContext>());
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (2)
AspireSqlServerEFCoreSqlClientExtensionsTests.cs (1)
274var exception = Assert.Throws<InvalidOperationException>(() => builder.AddSqlServerDbContext<TestDbContext>("sqlconnection"));
EnrichSqlServerTests.cs (1)
36var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichSqlServerDbContext<TestDbContext>());
Aspire.Milvus.Client.Tests (6)
MilvusClientPublicApiTests.cs (6)
20var exception = Assert.Throws<ArgumentNullException>(action); 33var exception = Assert.Throws<ArgumentNullException>(action); 46var exception = Assert.Throws<ArgumentException>(action); 59var exception = Assert.Throws<ArgumentNullException>(action); 72var exception = Assert.Throws<ArgumentNullException>(action); 85var exception = Assert.Throws<ArgumentException>(action);
Aspire.MongoDB.Driver.Tests (6)
MongoDBDriverPublicApiTests.cs (6)
19var exception = Assert.Throws<ArgumentNullException>(action); 31var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 67var exception = Assert.Throws<ArgumentNullException>(action); 79var exception = Assert.Throws<ArgumentException>(action);
Aspire.NATS.Net.Tests (7)
NatsClientPublicApiTests.cs (7)
23var exception = Assert.Throws<ArgumentNullException>(action); 36var exception = Assert.Throws<ArgumentNullException>(action); 49var exception = Assert.Throws<ArgumentException>(action); 62var exception = Assert.Throws<ArgumentNullException>(action); 75var exception = Assert.Throws<ArgumentNullException>(action); 88var exception = Assert.Throws<ArgumentException>(action); 99var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (2)
AspireEFPostgreSqlExtensionsTests.cs (1)
281var exception = Assert.Throws<InvalidOperationException>(() => builder.AddNpgsqlDbContext<TestDbContext>("npgsql"));
EnrichNpgsqlTests.cs (1)
37var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichNpgsqlDbContext<TestDbContext>());
Aspire.OpenAI.Tests (4)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (2)
123var ex = Assert.Throws<InvalidOperationException>(() => 154var ex = Assert.Throws<InvalidOperationException>(() =>
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (2)
123var ex = Assert.Throws<InvalidOperationException>(() => 154var ex = Assert.Throws<InvalidOperationException>(() =>
Aspire.Oracle.EntityFrameworkCore.Tests (2)
AspireOracleEFCoreDatabaseExtensionsTests.cs (1)
275var exception = Assert.Throws<InvalidOperationException>(() => builder.AddOracleDatabaseDbContext<TestDbContext>("orclconnection"));
EnrichOracleDatabaseTests.cs (1)
37var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichOracleDatabaseDbContext<TestDbContext>());
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (2)
AspireEFMySqlExtensionsTests.cs (1)
269var exception = Assert.Throws<InvalidOperationException>(() => builder.AddMySqlDbContext<TestDbContext>("mysql"));
EnrichMySqlTests.cs (1)
50var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichMySqlDbContext<TestDbContext>());
Binding.Http.IntegrationTests (3)
BasicHttpBindingTests.4.0.0.cs (1)
308Assert.Throws<FormatException>(() =>
NetHttpsBindingTests.4.1.0.cs (1)
62Assert.Throws<PlatformNotSupportedException>(() =>
OperationContextTests.cs (1)
52Assert.Throws<InvalidOperationException>(() => scope.Dispose());
Binding.UDS.IntegrationTests (1)
UDSBindingTests.cs (1)
197Assert.Throws<EndpointNotFoundException>(() => ((IChannel)serviceProxy).Open());
Client.ClientBase.IntegrationTests (6)
DuplexClientBaseTests.4.1.0.cs (2)
33var exception = Assert.Throws<InvalidOperationException>(() => 43Assert.Throws<CommunicationObjectFaultedException>(() =>
SessionTests.cs (4)
107Assert.Throws<InvalidOperationException>(() => 131Assert.Throws<InvalidOperationException>(() => 155Assert.Throws<InvalidOperationException>(() => 441Assert.Throws<CommunicationException>(() =>
Client.ExpectedExceptions.IntegrationTests (12)
ExpectedExceptionTests.4.0.0.cs (5)
28ActionNotSupportedException exception = Assert.Throws<ActionNotSupportedException>(() => 68TimeoutException exception = Assert.Throws<TimeoutException>(() => 115TimeoutException exception = Assert.Throws<TimeoutException>(() => 158FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 193FaultException<ExceptionDetail> exception = Assert.Throws<FaultException<ExceptionDetail>>(() =>
ExpectedExceptionTests.4.1.0.cs (6)
28EndpointNotFoundException exception = Assert.Throws<EndpointNotFoundException>(() => 130CommunicationException exception = Assert.Throws<CommunicationException>(() => 160EndpointNotFoundException exception = Assert.Throws<EndpointNotFoundException>(() => 198ProtocolException exception = Assert.Throws<ProtocolException>(() => 238FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 290FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() =>
ExpectedExceptionTests.4.1.1.cs (1)
27var exception = Assert.Throws<Exception>(() =>
Contract.Fault.IntegrationTests (6)
FaultExceptionTests.4.0.0.cs (6)
24FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 58FaultException<ExceptionDetail> exception = Assert.Throws<FaultException<ExceptionDetail>>(() => 101thrownException = Assert.Throws<FaultException<int>>(() => 130var exception = Assert.Throws<FaultException<FaultDetail>>(() => 167var exception = Assert.Throws<FaultException<FaultDetail2>>(() => 204var exception = Assert.Throws<FaultException<FaultDetail>>(() =>
Contract.Message.IntegrationTests (1)
MessageContractTests.cs (1)
57Assert.Throws<ProtocolException>(() =>
Contract.Service.IntegrationTests (2)
ServiceContractTests.4.1.0.cs (2)
276Assert.Throws<TimeoutException>(() => 332Assert.Throws<TimeoutException>(() =>
Encoding.Encoders.IntegrationTests (1)
TextEncodingTests.4.1.0.cs (1)
31Assert.Throws<ProtocolException>(() => { serviceProxy.ReturnContentType(testContentType); });
InMemory.FunctionalTests (40)
Http2\Http2StreamTests.cs (12)
1519ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 2144Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 2146Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 2147Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 2185Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 2186Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 2469Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 2470Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value")); 2471Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 2512Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 2513Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 5386var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
Http3\Http3StreamTests.cs (11)
862Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 864Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 865Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 896Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 897Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 1013Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 1014Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value")); 1015Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 1044Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 1045Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 1662var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
RequestTests.cs (2)
1701var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null)); 1794var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null));
ResponseHeaderTests.cs (5)
23Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 26Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 27Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 54Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 55Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
ResponseTests.cs (10)
83ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 117ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 1174completeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Complete()); 3424var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); 3520var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); 3583Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); 3614Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); 3644Assert.Throws<InvalidOperationException>(() => response.BodyWriter.Advance(1)); 4073Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1)); 4244Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1));
Interop.FunctionalTests (2)
Http3\Http3TlsTests.cs (2)
393Assert.Throws<InvalidOperationException>(host.Run); 426Assert.Throws<InvalidOperationException>(host.Run);
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
89Assert.Throws<ArgumentNullException>(() => a.Initialize(null!));
Microsoft.AspNetCore.AsyncState.Tests (1)
AsyncContextHttpContextOfTTests.cs (1)
71Assert.Throws<InvalidOperationException>(() => _context.Set(value));
Microsoft.AspNetCore.Authentication.Negotiate.Test (2)
LdapSettingsValidationTests.cs (2)
16Assert.Throws<ArgumentNullException>(() => settings.Validate()); 28Assert.Throws<ArgumentNullException>(() => settings.Validate());
Microsoft.AspNetCore.Authorization.Test (1)
AuthorizationAppBuilderExtensionsTests.cs (1)
52var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Components.Authorization.Tests (3)
AuthorizeViewTest.cs (2)
244var ex = Assert.Throws<InvalidOperationException>(() => 492var ex = Assert.Throws<NotSupportedException>(rootComponent.TriggerRender);
CascadingAuthenticationStateTest.cs (1)
28var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender());
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
Buffering\BufferedTextWriterTest.cs (1)
12Assert.Throws<NotSupportedException>(writer.Flush);
Microsoft.AspNetCore.Components.Server.Tests (5)
Circuits\RemoteJSRuntimeTest.cs (3)
33var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(id: 0, data)); 73var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(5, new byte[] { 0 })); 85var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(1, new byte[5000]));
ElementReferenceJsonConverterTest.cs (2)
84var ex = Assert.Throws<JsonException>(() => 103var ex = Assert.Throws<JsonException>(() =>
Microsoft.AspNetCore.Components.Tests (64)
CascadingParameterTest.cs (2)
325var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender()); 350var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender());
DependencyInjectionTest.cs (3)
44var ex = Assert.Throws<InvalidOperationException>(() => 57var ex = Assert.Throws<InvalidOperationException>(() => 73var ex = Assert.Throws<InvalidOperationException>(() =>
DynamicComponentTest.cs (2)
14var ex = Assert.Throws<InvalidOperationException>(() => 35var ex = Assert.Throws<InvalidOperationException>(
Lifetime\ComponentApplicationStateTest.cs (1)
96Assert.Throws<ArgumentException>(() => applicationState.PersistAsJson("MyState", myState));
NavigationManagerTest.cs (2)
56var ex = Assert.Throws<ArgumentException>(() => 74var ex = Assert.Throws<ArgumentException>(() =>
ParameterViewTest.Assignment.cs (15)
159var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 179var ex = Assert.Throws<InvalidOperationException>( 201var ex = Assert.Throws<InvalidOperationException>( 238var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 257var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 276var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 381var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 405var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 424var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 445var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 491var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 512var ex = Assert.Throws<InvalidOperationException>( 533var ex = Assert.Throws<InvalidOperationException>( 551var ex = Assert.Throws<InvalidOperationException>(() => 574var ex = Assert.Throws<InvalidOperationException>(() =>
ParameterViewTest.cs (2)
232Assert.Throws<InvalidCastException>(() => 338Assert.Throws<InvalidOperationException>(() => parameterView.SetParameterProperties(new object()));
RendererTest.cs (8)
2924var ex = Assert.Throws<InvalidOperationException>(component.TriggerRender); 4430var ex = Assert.Throws<InvalidOperationException>( 4460Assert.Throws<InvalidOperationException>(() => parameterView.SetParameterProperties(new object())); 4828var ex = Assert.Throws<ArgumentException>(() => 4854var ex = Assert.Throws<ArgumentException>(() => 4883var ex = Assert.Throws<InvalidOperationException>(() => 5043var ex = Assert.Throws<NotSupportedException>(() => component.TriggerRender()); 5061var ex = Assert.Throws<NotSupportedException>(component.TriggerRender);
Rendering\RendererSynchronizationContextTest.cs (1)
316Assert.Throws<InvalidTimeZoneException>(() => context.Send((_) =>
Rendering\RenderTreeBuilderTest.cs (27)
435Assert.Throws<InvalidOperationException>(() => 448Assert.Throws<InvalidOperationException>(() => 461Assert.Throws<InvalidOperationException>(() => 474Assert.Throws<InvalidOperationException>(() => 489Assert.Throws<InvalidOperationException>(() => 504Assert.Throws<InvalidOperationException>(() => 519Assert.Throws<InvalidOperationException>(() => 533Assert.Throws<InvalidOperationException>(() => 547Assert.Throws<InvalidOperationException>(() => 562Assert.Throws<InvalidOperationException>(() => 577Assert.Throws<InvalidOperationException>(() => 592Assert.Throws<InvalidOperationException>(() => 738Assert.Throws<InvalidOperationException>(() => 751Assert.Throws<InvalidOperationException>(() => 765Assert.Throws<InvalidOperationException>(() => 827Assert.Throws<InvalidOperationException>(() => 840Assert.Throws<InvalidOperationException>(() => 854Assert.Throws<InvalidOperationException>(() => 1747var ex = Assert.Throws<InvalidOperationException>(() => 1763var ex = Assert.Throws<InvalidOperationException>(() => 2136var ex = Assert.Throws<InvalidOperationException>(() => 2175var ex = Assert.Throws<InvalidOperationException>(() => 2211var ex = Assert.Throws<InvalidOperationException>(() => 2226var ex = Assert.Throws<ArgumentNullException>(() => 2241var ex = Assert.Throws<ArgumentNullException>(() => 2256var ex = Assert.Throws<ArgumentException>(() => 2272var ex = Assert.Throws<InvalidOperationException>(() =>
RouteViewTest.cs (1)
35var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Components.Web.Tests (6)
Forms\InputBaseTest.cs (1)
21var ex = Assert.Throws<InvalidOperationException>(() => rootComponent.TriggerRender());
Forms\Mapping\FormMappingScopeTest.cs (3)
91var exception = Assert.Throws<InvalidOperationException>(() => _renderer.RenderRootComponent(id)); 106var exception = Assert.Throws<InvalidOperationException>(() => _renderer.RenderRootComponent(id)); 129var exception = Assert.Throws<InvalidOperationException>(testComponent.TriggerRender);
HtmlRendering\HtmlRendererTest.cs (2)
42var ex = Assert.Throws<InvalidOperationException>(() => htmlContent.WriteHtmlTo(new StringWriter())); 935var ex = Assert.Throws<InvalidTimeZoneException>(() =>
Microsoft.AspNetCore.CookiePolicy.Test (5)
CookieConsentTests.cs (1)
331Assert.Throws<InvalidOperationException>(() => context.Response.Cookies.Append("Test", "Value"));
CookiePolicyTests.cs (4)
338Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A")); 339Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A", new CookieOptions())); 340Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A")); 341Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A", new CookieOptions()));
Microsoft.AspNetCore.Cors.Test (2)
CorsPolicyTests.cs (1)
48var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
CorsResultTests.cs (1)
30var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Microsoft.AspNetCore.Cryptography.Internal.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.DataProtection.Abstractions.Tests (3)
DataProtectionCommonExtensionsTests.cs (3)
250var ex = Assert.Throws<CryptographicException>(() => 278var ex = Assert.Throws<CryptographicException>(() => 292var ex = Assert.Throws<CryptographicException>(() =>
Microsoft.AspNetCore.DataProtection.Extensions.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.DataProtection.Tests (5)
Internal\KeyManagementOptionsPostSetupTest.cs (1)
168Assert.Throws<InvalidOperationException>(() => repository.StoreElement(xElement, friendlyName: null));
SecretTests.cs (2)
218Assert.Throws<ObjectDisposedException>( 259Assert.Throws<ObjectDisposedException>(
ServiceCollectionTests.cs (1)
102Assert.Throws<InvalidOperationException>(() => repository.StoreElement(xElement, friendlyName: null));
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (2)
HealthCheckEndpointRouteBuilderExtensionsTest.cs (1)
38var ex = Assert.Throws<InvalidOperationException>(() => host.Start());
HealthCheckMiddlewareTests.cs (1)
33var ex = Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Diagnostics.Tests (1)
ExceptionHandlerTest.cs (1)
526var exception = Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Hosting.Tests (7)
ConfigureBuilderTests.cs (1)
26var ex = Assert.Throws<InvalidOperationException>(() => action.Invoke(applicationBuilder));
WebHostBuilderTests.cs (6)
233Assert.Throws<InvalidOperationException>(() => host.Start()); 261Assert.Throws<InvalidOperationException>(() => host.Start()); 714var ex = Assert.Throws<InvalidOperationException>(() => 1012var exception = Assert.Throws<NotSupportedException>(() => 1033var exception = Assert.Throws<NotSupportedException>(() => 1251Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
RouteValueDictionaryTests.cs (1)
352var exception = Assert.Throws<InvalidOperationException>(() =>
UseWhenExtensionsTests.cs (2)
21Assert.Throws<ArgumentNullException>(nullPredicate); 22Assert.Throws<ArgumentNullException>(nullConfiguration);
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ResponseExtensionTests.cs (1)
31Assert.Throws<InvalidOperationException>(() => context.Response.Clear());
UriHelperTests.cs (1)
192Assert.Throws<ArgumentNullException>(() => UriHelper.FromAbsolute(null, out resScheme, out resHost, out resPath, out resQuery, out resFragment));
Microsoft.AspNetCore.Http.Tests (6)
HeaderDictionaryTests.cs (3)
96Assert.Throws<InvalidOperationException>(() => headers.Add(new KeyValuePair<string, StringValues>("header1", "value1"))); 97Assert.Throws<InvalidOperationException>(() => headers.Add("header1", "value1")); 98Assert.Throws<InvalidOperationException>(() => headers.Clear());
Internal\ReferenceReadStreamTests.cs (3)
35Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 42Assert.Throws<NotSupportedException>(() => stream.Write(new byte[1], 0, 1)); 49Assert.Throws<NotSupportedException>(() => stream.WriteByte(0));
Microsoft.AspNetCore.HttpsPolicy.Tests (2)
HstsMiddlewareTests.cs (2)
24Assert.Throws<ArgumentNullException>(() => 33Assert.Throws<ArgumentNullException>(() =>
Microsoft.AspNetCore.Identity.Test (2)
PasswordHasherTest.cs (2)
29var ex = Assert.Throws<InvalidOperationException>(() => 42var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.InternalTesting.Tests (2)
LogValuesAssertTest.cs (2)
119var equalException = Assert.Throws<EqualException>( 207var equalException = Assert.Throws<EqualException>(
Microsoft.AspNetCore.JsonPatch.Tests (26)
IntegrationTests\AnonymousObjectIntegrationTest.cs (7)
21var exception = Assert.Throws<JsonPatchException>(() => 45var exception = Assert.Throws<JsonPatchException>(() => 68var exception = Assert.Throws<JsonPatchException>(() => 91var exception = Assert.Throws<JsonPatchException>(() => 115var exception = Assert.Throws<JsonPatchException>(() => 139var exception = Assert.Throws<JsonPatchException>(() => 180var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\DictionaryIntegrationTest.cs (1)
168var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\DynamicObjectIntegrationTest.cs (3)
60var exception = Assert.Throws<JsonPatchException>(() => 160var exception = Assert.Throws<JsonPatchException>(() => 225var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\ExpandoObjectIntegrationTest.cs (5)
147var exception = Assert.Throws<JsonPatchException>(() => 168var exception = Assert.Throws<JsonPatchException>(() => 272var exception = Assert.Throws<JsonPatchException>(() => 312var exception = Assert.Throws<JsonPatchException>(() => 354var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\ListIntegrationTest.cs (3)
48var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); }); 160var exception = Assert.Throws<JsonPatchException>(() => 248var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); });
IntegrationTests\SimpleObjectIntegrationTest.cs (1)
164var ex = Assert.Throws<JsonPatchException>(() => document.ApplyTo(target));
Internal\ParsedPathTests.cs (1)
36Assert.Throws<JsonPatchException>(() =>
JsonPatchDocumentJObjectTest.cs (1)
43Assert.Throws<JsonPatchException>(() => patch.ApplyTo(model));
JsonPatchDocumentTest.cs (4)
19var exception = Assert.Throws<JsonPatchException>(() => 37var exception = Assert.Throws<JsonPatchException>(() => 135var exception = Assert.Throws<JsonSerializationException>(() => 152var exception = Assert.Throws<JsonSerializationException>(() =>
Microsoft.AspNetCore.Mvc.Abstractions.Test (5)
ModelBinding\ModelStateDictionaryTest.cs (5)
193var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldSkipped("key")); 252var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldValid("key")); 1687var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.SetModelValue(key, string.Empty, string.Empty)); 1705var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldValid(key)); 1723var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldSkipped(key));
Microsoft.AspNetCore.Mvc.Core.Test (5)
ApplicationModels\AttributeRouteModelTests.cs (2)
170var ex = Assert.Throws<InvalidOperationException>( 197var ex = Assert.Throws<InvalidOperationException>(
Builder\MvcApplicationBuilderExtensionsTest.cs (1)
71var ex = Assert.Throws<InvalidOperationException>(() =>
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
1095Assert.Throws<InvalidTimeZoneException>( 1279var ex = Assert.Throws<InvalidOperationException>(() => validator.Validate(actionContext, validationState, prefix: string.Empty, model));
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (3)
XmlAssertTest.cs (3)
20var equalException = Assert.Throws<EqualException>(() => XmlAssert.Equal(input1, input2)); 72Assert.Throws<EqualException>(() => XmlAssert.Equal(input1, input2)); 113var equalException = Assert.Throws<EqualException>(() => XmlAssert.Equal(expected, actual));
Microsoft.AspNetCore.Mvc.Localization.Test (1)
HtmlLocalizerTest.cs (1)
148var exception = Assert.Throws<FormatException>(
Microsoft.AspNetCore.Mvc.Razor.Test (4)
RazorPageActivatorTest.cs (1)
166Assert.Throws<InvalidCastException>(() => activator.Activate(instance, viewContext));
RazorPageTest.cs (2)
665var ex = Assert.Throws<InvalidOperationException>(() => page.EnsureRenderedBodyOrSections()); 704var ex = Assert.Throws<InvalidOperationException>(() => page.EnsureRenderedBodyOrSections());
TagHelpers\UrlResolutionTagHelperTest.cs (1)
380var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
InputTagHelperTest.cs (2)
149var ex = Assert.Throws<InvalidOperationException>(() => tagHelper.Process(context, output)); 196var ex = Assert.Throws<InvalidOperationException>(() => tagHelper.Process(context, output));
TagHelperOutputExtensionsTest.cs (2)
1053var exceptionAdd = Assert.Throws<ArgumentException>(() => tagHelperOutput.AddClass(classValue, htmlEncoder)); 1054var exceptionRemove = Assert.Throws<ArgumentException>(() => tagHelperOutput.RemoveClass(classValue, htmlEncoder));
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (9)
AttributeDictionaryTest.cs (1)
59Assert.Throws<InvalidOperationException>(() => attributes.Add("one", "15"));
Rendering\HtmlHelperPartialExtensionsTest.cs (1)
176var actual = Assert.Throws<InvalidOperationException>(() => partialMethod(helper.Object));
SessionStateTempDataProviderTest.cs (2)
26Assert.Throws<InvalidOperationException>(() => 39Assert.Throws<InvalidOperationException>(() =>
ViewComponents\ViewViewComponentResultTest.cs (3)
175var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext)); 213var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext)); 253var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext));
ViewDataDictionaryTest.cs (2)
141var exception = Assert.Throws<InvalidOperationException>(() => viewData.SetModelPublic(model)); 402var exception = Assert.Throws<InvalidOperationException>(() => viewData.SetModelPublic(value: null));
Microsoft.AspNetCore.Owin.Tests (3)
OwinEnvironmentTests.cs (3)
148Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null, 0)); // array is null 149Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(kvp, -1)); // arrayIndex is less than 0 150Assert.Throws<ArgumentException>(() => collection.CopyTo(kvp, 1)); // The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.
Microsoft.AspNetCore.Razor.Runtime.Test (1)
Runtime\TagHelpers\TagHelperScopeManagerTest.cs (1)
215var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.RequestDecompression.Tests (3)
RequestDecompressionBuilderExtensionsTests.cs (1)
17Assert.Throws<ArgumentNullException>(() =>
RequestDecompressionServiceExtensionsTests.cs (2)
18Assert.Throws<ArgumentNullException>(() => 32Assert.Throws<ArgumentNullException>(() =>
Microsoft.AspNetCore.Routing.Tests (12)
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
470Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo"))));
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (1)
500Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo"))));
DefaultInlineConstraintResolverTest.cs (1)
290var ex = Assert.Throws<InvalidOperationException>(() => routeOptions.SetParameterPolicy("custom", typeof(string)));
Matching\CandidateSetTest.cs (1)
321var ex = Assert.Throws<InvalidOperationException>(() => candidateSet.ExpandEndpoint(0, Array.Empty<Endpoint>(), comparer));
Matching\DataSourceDependentMatcherTest.cs (1)
225var exception = Assert.Throws<AggregateException>(
Matching\HostMatcherPolicyTest.cs (2)
97Assert.Throws<InvalidOperationException>(() => 189Assert.Throws<InvalidOperationException>(() =>
Patterns\RoutePatternFactoryTest.cs (2)
305Assert.Throws<InvalidOperationException>(() => 608var exception = Assert.Throws<InvalidOperationException>(() =>
Template\RoutePrecedenceTestsBase.cs (2)
101var ex = Assert.Throws<InvalidOperationException>(() => 114var ex = Assert.Throws<InvalidOperationException>(() =>
TemplateParserDefaultValuesTests.cs (1)
108var ex = Assert.Throws<RouteCreationException>(() =>
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (14)
DelegateTests.cs (2)
88Assert.Throws<InvalidOperationException>(() => delegateFeature.DelegateRequest(destination)); 154Assert.Throws<InvalidOperationException>(() => delegateFeature.DelegateRequest(destination));
Listener\ResponseHeaderTests.cs (5)
305Assert.Throws<InvalidOperationException>(() => 310Assert.Throws<InvalidOperationException>(() => 315Assert.Throws<InvalidOperationException>(() => 320Assert.Throws<InvalidOperationException>(() => 326Assert.Throws<InvalidOperationException>(() =>
RequestBodyLimitTests.cs (2)
190var ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); }); 193ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
ResponseHeaderTests.cs (2)
229Assert.Throws<InvalidOperationException>(() => responseHeaders.Add("Custom3", new string[] { "value3a, value3b", "value3c" })); 260Assert.Throws<InvalidOperationException>(() => responseHeaders.Add("Custom3", new string[] { "value3a, value3b", "value3c" }));
ResponseTests.cs (1)
205Assert.Throws<InvalidTimeZoneException>(() => httpContext.Response.Body.Write(new byte[10], 0, 10));
ResponseTrailersTests.cs (2)
66Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer(header, "value")); 128Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer("TrailerName", "Trailer Value"));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (65)
BodyControlTests.cs (12)
95Assert.Throws<Exception>(() => requestPipe.AdvanceTo(new SequencePosition()))); 97Assert.Throws<Exception>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition()))); 99Assert.Throws<Exception>(() => requestPipe.CancelPendingRead())); 103Assert.Throws<Exception>(() => requestPipe.Complete())); 115Assert.Throws<ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition())); 116Assert.Throws<ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition())); 117Assert.Throws<ObjectDisposedException>(() => requestPipe.CancelPendingRead()); 119Assert.Throws<ObjectDisposedException>(() => requestPipe.Complete()); 132Assert.Throws<ObjectDisposedException>(() => responsePipe.Advance(1)); 133Assert.Throws<ObjectDisposedException>(() => responsePipe.CancelPendingFlush()); 135Assert.Throws<ObjectDisposedException>(() => responsePipe.GetSpan()); 136Assert.Throws<ObjectDisposedException>(() => responsePipe.Complete());
DiagnosticMemoryPoolTests.cs (5)
21var exception = Assert.Throws<InvalidOperationException>(() => memoryPool.Dispose()); 32var exception = Assert.Throws<InvalidOperationException>(() => block.Dispose()); 42var exception = Assert.Throws<InvalidOperationException>(() => block.Dispose()); 217var exception = Assert.Throws<InvalidOperationException>(() => memoryPool.Dispose()); 223var exception = Assert.Throws<AggregateException>(() => memoryPool.Dispose());
Http1\Http1ConnectionTests.cs (1)
325Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)_http1Connection).OnStarting(_ => Task.CompletedTask, null));
HttpParserTests.cs (3)
332Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 384Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 586var badHttpRequestException = Assert.Throws<BadHttpRequestException>(() =>
HttpRequestHeadersTests.cs (5)
299Assert.Throws<ArgumentException>(() => headers.Add("host", new[] { "localhost" })); 300Assert.Throws<ArgumentException>(() => headers.Add("custom", new[] { "value" })); 301Assert.Throws<ArgumentException>(() => headers.Add("Content-Length", new[] { "0" })); 562Assert.Throws<InvalidOperationException>((Action)(() => 654Assert.Throws<InvalidOperationException>(() =>
HttpRequestStreamTests.cs (4)
57Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 72Assert.Throws<NotSupportedException>(() => stream.Write(new byte[1], 0, 1)); 79Assert.Throws<NotSupportedException>(() => stream.WriteByte(0)); 123var ioEx2 = Assert.Throws<InvalidOperationException>(() => stream.CopyTo(Stream.Null));
HttpResponseHeadersTests.cs (16)
110Assert.Throws<InvalidOperationException>(() => 115Assert.Throws<InvalidOperationException>(() => 120Assert.Throws<InvalidOperationException>(() => 125Assert.Throws<InvalidOperationException>(() => 131Assert.Throws<InvalidOperationException>(() => 155Assert.Throws<InvalidOperationException>(() => 161Assert.Throws<InvalidOperationException>(() => 193Assert.Throws<InvalidOperationException>(() => 199Assert.Throws<InvalidOperationException>(() => 204Assert.Throws<InvalidOperationException>(() => 209Assert.Throws<InvalidOperationException>(() => 214Assert.Throws<InvalidOperationException>(() => 219Assert.Throws<InvalidOperationException>(() => 225Assert.Throws<InvalidOperationException>(() => 309Assert.Throws<InvalidOperationException>(() => dictionary.Clear()); 319var exception = Assert.Throws<InvalidOperationException>(() => dictionary.Add("Content-Length", new[] { contentLength }));
HttpResponsePipeWriterTests.cs (6)
19var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.Advance(1); }); 29var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.GetMemory(); }); 39var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.GetSpan(); }); 49var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.Complete(); }); 59var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.FlushAsync(); }); 69var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.WriteAsync(new Memory<byte>()); });
HttpResponseStreamTests.cs (2)
85Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 123var ioEx = Assert.Throws<InvalidOperationException>(() => stream.Write(new byte[1], 0, 1));
KestrelServerLimitsTests.cs (4)
23Assert.Throws<ArgumentOutOfRangeException>(() => 52Assert.Throws<ArgumentOutOfRangeException>(() => 80Assert.Throws<ArgumentOutOfRangeException>(() => 134Assert.Throws<ArgumentOutOfRangeException>(() =>
KestrelServerTests.cs (5)
55var exception = Assert.Throws<FormatException>(() => StartDummyApplication(server)); 87var ex = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 126var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 232var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 259var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server));
ThrowingWasUpgradedWriteOnlyStreamTests.cs (2)
22Assert.Equal(CoreStrings.ResponseStreamWasUpgraded, Assert.Throws<InvalidOperationException>(() => stream.Write(new byte[1], 0, 1)).Message); 24Assert.Equal(CoreStrings.ResponseStreamWasUpgraded, Assert.Throws<InvalidOperationException>(() => stream.Flush()).Message);
Microsoft.AspNetCore.Server.Kestrel.Tests (13)
HttpsConfigurationTests.cs (4)
46Assert.Throws<InvalidOperationException>(host.Run); 73Assert.Throws<InvalidOperationException>(host.Run); 106Assert.Throws<InvalidOperationException>(host.Run); 176Assert.Throws<InvalidOperationException>(host.Run);
KestrelConfigurationLoaderTests.cs (9)
572var ex = Assert.Throws<ArgumentException>(() => 597var ex = Assert.Throws<ArgumentException>(() => 622var ex = Assert.Throws<CryptographicException>(() => 646var ex = Assert.Throws<InvalidOperationException>(() => 775var ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 784ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 793ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 802ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 811ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
Microsoft.AspNetCore.Shared.Tests (17)
runtime\Http2\HPackDecoderTest.cs (15)
176HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 253HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x7e }, endHeaders: true, handler: _handler)); 277HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 301HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 325HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 371HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 403HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x0f, 0x2f }, endHeaders: true, handler: _handler)); 498HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x1f, 0x2f }, endHeaders: true, handler: _handler)); 621HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 636HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 663HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 676HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 727var ex = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler)); 867HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 901HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
runtime\Http3\QPackDecoderTest.cs (1)
295QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
WebEncodersTests.cs (1)
33Assert.Throws<FormatException>(() =>
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Internal\Formatters\BinaryMessageParserTests.cs (1)
68var ex = Assert.Throws<FormatException>(() =>
Internal\Protocol\HandshakeProtocolTests.cs (1)
91var exception = Assert.Throws<InvalidDataException>(() =>
Microsoft.AspNetCore.SignalR.Tests (2)
MapSignalRTests.cs (2)
21var ex = Assert.Throws<NotSupportedException>(() => 50var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaServicesExtensionsTests.cs (1)
35var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
1818Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddSingleton(new Service())); 1820Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddScoped<IService, Service>());
Microsoft.AspNetCore.WebUtilities.Tests (11)
FileBufferingWriteStreamTests.cs (2)
255var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length)); 270var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length));
HttpRequestStreamReaderTest.cs (4)
346Assert.Throws<ArgumentNullException>(() => 357Assert.Throws<ArgumentOutOfRangeException>(() => 368Assert.Throws<ArgumentException>(() => 381Assert.Throws<ObjectDisposedException>(() =>
HttpResponseStreamWriterTest.cs (4)
734Assert.Throws<ArgumentNullException>(() => 745Assert.Throws<ArgumentOutOfRangeException>(() => 756Assert.Throws<ArgumentException>(() => 769Assert.Throws<ObjectDisposedException>(() =>
MultipartReaderTests.cs (1)
275Assert.Throws<ArgumentOutOfRangeException>(() =>
Microsoft.Build.CommandLine.UnitTests (1)
CommandLineSwitches_Tests.cs (1)
1150Assert.Throws<InitializationException>(() =>
Microsoft.Build.Engine.OM.UnitTests (236)
Construction\ConstructionEditing_Tests.cs (31)
105Assert.Throws<InvalidOperationException>(() => 119Assert.Throws<InvalidOperationException>(() => 133Assert.Throws<InvalidOperationException>(() => 148Assert.Throws<InvalidOperationException>(() => 164Assert.Throws<InvalidOperationException>(() => 178Assert.Throws<InvalidOperationException>(() => 194Assert.Throws<InvalidOperationException>(() => 210Assert.Throws<InvalidOperationException>(() => 228Assert.Throws<InvalidOperationException>(() => 246Assert.Throws<InvalidOperationException>(() => 260Assert.Throws<InvalidOperationException>(() => 274Assert.Throws<InvalidOperationException>(() => 289Assert.Throws<InvalidOperationException>(() => 304Assert.Throws<InvalidOperationException>(() => 319Assert.Throws<InvalidOperationException>(() => 334Assert.Throws<InvalidOperationException>(() => 350Assert.Throws<InvalidOperationException>(() => 630Assert.Throws<InvalidOperationException>(() => 644Assert.Throws<InvalidOperationException>(() => 660Assert.Throws<InvalidOperationException>(() => 1192Assert.Throws<ArgumentException>(() => 1205Assert.Throws<ArgumentException>(() => 1220Assert.Throws<InvalidOperationException>(() => 1237Assert.Throws<InvalidOperationException>(() => 1255Assert.Throws<InvalidOperationException>(() => 1271Assert.Throws<InvalidOperationException>(() => 1287Assert.Throws<InvalidOperationException>(() => 2257Assert.Throws<InvalidOperationException>(() => 2269Assert.Throws<InvalidOperationException>(() => 2281Assert.Throws<ArgumentException>(() => 2308Assert.Throws<InvalidProjectFileException>(infiniteChooseLoop);
Construction\ProjectChooseElement_Tests.cs (9)
29Assert.Throws<InvalidProjectFileException>(() => 47Assert.Throws<InvalidProjectFileException>(() => 64Assert.Throws<InvalidProjectFileException>(() => 83Assert.Throws<InvalidProjectFileException>(() => 107Assert.Throws<InvalidProjectFileException>(() => 126Assert.Throws<InvalidProjectFileException>(() => 146Assert.Throws<InvalidProjectFileException>(() => 169Assert.Throws<InvalidProjectFileException>(() => 237Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectExtensionsElement_Tests.cs (3)
47Assert.Throws<InvalidProjectFileException>(() => 64Assert.Throws<InvalidProjectFileException>(() => 98Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectImportElement_Tests.cs (4)
40Assert.Throws<InvalidProjectFileException>(() => 57Assert.Throws<InvalidProjectFileException>(() => 74Assert.Throws<InvalidProjectFileException>(() => 136Assert.Throws<ArgumentException>(() =>
Construction\ProjectImportGroupElement_Tests.cs (5)
179Assert.Throws<InvalidProjectFileException>(() => 199Assert.Throws<InvalidProjectFileException>(() => 219Assert.Throws<InvalidProjectFileException>(() => 238Assert.Throws<InvalidProjectFileException>(() => 346Assert.Throws<ArgumentException>(() =>
Construction\ProjectItemDefinitionElement_Tests.cs (1)
194Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectItemDefinitionGroupElement_Tests.cs (1)
36Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectItemElement_Tests.cs (20)
132Assert.Throws<InvalidProjectFileException>(() => 160Assert.Throws<InvalidProjectFileException>(() => 188Assert.Throws<InvalidProjectFileException>(() => 216Assert.Throws<InvalidProjectFileException>(() => 237Assert.Throws<InvalidProjectFileException>( 260Assert.Throws<InvalidProjectFileException>( 301Assert.Throws<InvalidProjectFileException>(() => 445Assert.Throws<InvalidProjectFileException>(() => 470Assert.Throws<InvalidProjectFileException>(() => 495Assert.Throws<InvalidProjectFileException>(() => 527Assert.Throws<InvalidProjectFileException>(() => 555Assert.Throws<InvalidProjectFileException>(() => 583Assert.Throws<InvalidProjectFileException>(() => 741Assert.Throws<InvalidOperationException>(() => 757Assert.Throws<InvalidOperationException>(() => 818Assert.Throws<InvalidOperationException>(() => 834Assert.Throws<InvalidOperationException>(() => 850Assert.Throws<InvalidOperationException>(() => 912Assert.Throws<InvalidOperationException>(() => 928Assert.Throws<InvalidOperationException>(() =>
Construction\ProjectMetadataElement_Tests.cs (14)
49Assert.Throws<InvalidProjectFileException>(() => 70Assert.Throws<InvalidProjectFileException>(() => 103Assert.Throws<InvalidProjectFileException>(() => 115Assert.Throws<InvalidProjectFileException>(() => 148Assert.Throws<InvalidProjectFileException>(() => 160Assert.Throws<InvalidProjectFileException>(() => 196Assert.Throws<InvalidProjectFileException>(() => 247Assert.Throws<ArgumentException>(() => 261Assert.Throws<InvalidProjectFileException>(() => 274Assert.Throws<InvalidProjectFileException>(() => 309Assert.Throws<InvalidProjectFileException>(() => 336Assert.Throws<InvalidProjectFileException>(() => 360Assert.Throws<ArgumentNullException>(() => 373Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectOnErrorElement_Tests.cs (9)
70Assert.Throws<InvalidProjectFileException>(() => 96Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() => 138Assert.Throws<InvalidProjectFileException>(() => 159Assert.Throws<InvalidProjectFileException>(() => 179Assert.Throws<InvalidProjectFileException>(() => 199Assert.Throws<InvalidProjectFileException>(() => 232Assert.Throws<ArgumentNullException>(() => 245Assert.Throws<ArgumentException>(() =>
Construction\ProjectOutputElement_Tests.cs (9)
56Assert.Throws<InvalidProjectFileException>(() => 78Assert.Throws<InvalidProjectFileException>(() => 100Assert.Throws<InvalidProjectFileException>(() => 122Assert.Throws<InvalidProjectFileException>(() => 144Assert.Throws<InvalidProjectFileException>(() => 168Assert.Throws<InvalidProjectFileException>(() => 190Assert.Throws<InvalidProjectFileException>(() => 240Assert.Throws<InvalidOperationException>(() => 267Assert.Throws<InvalidOperationException>(() =>
Construction\ProjectPropertyElement_Tests.cs (7)
62Assert.Throws<InvalidProjectFileException>(() => 81Assert.Throws<InvalidProjectFileException>(() => 100Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() => 138Assert.Throws<InvalidProjectFileException>(() => 216Assert.Throws<ArgumentException>(() => 243Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectRootElement_Tests.cs (16)
272Assert.Throws<InvalidProjectFileException>(() => 284Assert.Throws<InvalidProjectFileException>(() => 297Assert.Throws<InvalidProjectFileException>(() => 312Assert.Throws<InvalidProjectFileException>(() => 329Assert.Throws<InvalidProjectFileException>(() => 344Assert.Throws<InvalidProjectFileException>(() => 396Assert.Throws<InvalidProjectFileException>(() => 416Assert.Throws<InvalidProjectFileException>(() => 557Assert.Throws<InvalidOperationException>(() => 694Assert.Throws<InvalidOperationException>(() => 991Assert.Throws<InvalidProjectFileException>(() => 1640Assert.Throws<InvalidProjectFileException>( 1660Assert.Throws<InvalidOperationException>( 1679Assert.Throws<InvalidOperationException>( 1807Assert.Throws<InvalidProjectFileException>( 1827Assert.Throws<InvalidOperationException>(
Construction\ProjectTargetElement_Tests.cs (8)
31Assert.Throws<ArgumentException>(() => 106Assert.Throws<ArgumentNullException>(() => 118Assert.Throws<ArgumentNullException>(() => 130Assert.Throws<ArgumentNullException>(() => 142Assert.Throws<ArgumentNullException>(() => 166Assert.Throws<InvalidProjectFileException>(() => 183Assert.Throws<InvalidProjectFileException>(() => 358var error = Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectTaskElement_Tests.cs (5)
86Assert.Throws<InvalidProjectFileException>(() => 172Assert.Throws<ArgumentNullException>(() => 185Assert.Throws<ArgumentException>(() => 198Assert.Throws<ArgumentException>(() => 211Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectUsingTaskElement_Tests.cs (16)
37Assert.Throws<InvalidProjectFileException>(() => 54Assert.Throws<InvalidProjectFileException>(() => 71Assert.Throws<InvalidProjectFileException>(() => 88Assert.Throws<InvalidProjectFileException>(() => 105Assert.Throws<InvalidProjectFileException>(() => 122Assert.Throws<InvalidProjectFileException>(() => 139Assert.Throws<InvalidProjectFileException>(() => 156Assert.Throws<InvalidProjectFileException>(() => 173Assert.Throws<InvalidProjectFileException>(() => 277Assert.Throws<InvalidOperationException>(() => 290Assert.Throws<InvalidOperationException>(() => 348Assert.Throws<InvalidProjectFileException>(() => 368Assert.Throws<InvalidProjectFileException>(() => 388Assert.Throws<InvalidProjectFileException>(() => 433Assert.Throws<InvalidProjectFileException>(() => 456Assert.Throws<InvalidProjectFileException>(() =>
Construction\SolutionFile_Tests.cs (2)
58Assert.Throws<InvalidProjectFileException>(() => 138Assert.Throws<InvalidProjectFileException>(() =>
Construction\UsingTaskBodyElement_Tests.cs (3)
38Assert.Throws<InvalidProjectFileException>(() => 58Assert.Throws<InvalidProjectFileException>(() => 105Assert.Throws<ArgumentNullException>(() =>
Construction\UsingTaskParameterElement_Tests.cs (1)
80Assert.Throws<InvalidProjectFileException>(() =>
Construction\UsingTaskParameterGroup_Tests.cs (2)
107Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() =>
Definition\DefinitionEditing_Tests.cs (10)
230Assert.Throws<ArgumentException>(() => 1589Assert.Throws<InvalidOperationException>(() => 1604Assert.Throws<InvalidOperationException>(() => 1619Assert.Throws<InvalidOperationException>(() => 1634Assert.Throws<InvalidOperationException>(() => 1649Assert.Throws<InvalidOperationException>(() => 1723Assert.Throws<InvalidOperationException>(() => 1738Assert.Throws<InvalidOperationException>(() => 2154Assert.Throws<ArgumentException>(() => 2603var ex = Assert.Throws<InvalidOperationException>(() => itemOperation(project, item));
Definition\Project_Tests.cs (1)
4274Assert.Throws<InvalidProjectFileException>(() => project.ReevaluateIfNecessary());
Definition\ProjectCollection_Tests.cs (8)
373Assert.Throws<InvalidOperationException>(() => 740Assert.Throws<InvalidOperationException>(() => 755Assert.Throws<InvalidOperationException>(() => 1017Assert.Throws<ArgumentNullException>(() => 1061Assert.Throws<ArgumentNullException>(() => 1073Assert.Throws<ArgumentException>(() => 1121Assert.Throws<ArgumentException>(() => 1133Assert.Throws<InvalidOperationException>(() =>
Definition\ProjectItem_Tests.cs (11)
234Assert.Throws<ArgumentException>(() => 247Assert.Throws<ArgumentException>(() => 260Assert.Throws<InvalidOperationException>(() => 1630Assert.Throws<InvalidProjectFileException>(() => 1913Assert.Throws<InvalidOperationException>(() => 1946Assert.Throws<ArgumentException>(() => 2037Assert.Throws<ArgumentException>(() => 2052Assert.Throws<InvalidOperationException>(() => 2083Assert.Throws<InvalidOperationException>(() => 2114Assert.Throws<InvalidOperationException>(() => 2997var exception = Assert.Throws<InvalidProjectFileException>(() =>
Definition\ProjectItemDefinition_Tests.cs (9)
119Assert.Throws<InvalidOperationException>(() => 473Assert.Throws<InvalidProjectFileException>(() => 495Assert.Throws<InvalidProjectFileException>(() => 517Assert.Throws<InvalidProjectFileException>(() => 539Assert.Throws<InvalidProjectFileException>(() => 561Assert.Throws<InvalidProjectFileException>(() => 583Assert.Throws<InvalidProjectFileException>(() => 605Assert.Throws<InvalidProjectFileException>(() => 627Assert.Throws<InvalidProjectFileException>(() =>
Definition\ProjectMetadata_Tests.cs (1)
459Assert.Throws<InvalidOperationException>(() =>
Definition\ProjectProperty_Tests.cs (2)
136Assert.Throws<InvalidOperationException>(() => 259Assert.Throws<InvalidOperationException>(() =>
Definition\ProtectImports_Tests.cs (12)
132Assert.Throws<InvalidOperationException>(() => 163Assert.Throws<InvalidOperationException>(() => 182Assert.Throws<InvalidOperationException>(() => 197Assert.Throws<InvalidOperationException>(() => 212Assert.Throws<InvalidOperationException>(() => 227Assert.Throws<InvalidOperationException>(() => 302Assert.Throws<InvalidOperationException>(() => 317Assert.Throws<InvalidOperationException>(() => 332Assert.Throws<InvalidOperationException>(() => 347Assert.Throws<InvalidOperationException>(() => 425Assert.Throws<InvalidOperationException>(() => 440Assert.Throws<InvalidOperationException>(() =>
Instance\ProjectInstance_Tests.cs (6)
155Assert.Throws<ArgumentNullException>(() => 167Assert.Throws<ArgumentException>(() => 179Assert.Throws<ArgumentNullException>(() => 344Assert.Throws<ArgumentNullException>(() => 356Assert.Throws<ArgumentNullException>(() => 368Assert.Throws<ArgumentNullException>(() =>
Instance\ProjectItemInstance_Tests.cs (5)
227Assert.Throws<ArgumentException>(() => 239Assert.Throws<ArgumentNullException>(() => 301Assert.Throws<ArgumentNullException>(() => 313Assert.Throws<ArgumentException>(() => 735Assert.Throws<InvalidProjectFileException>(() =>
Instance\ProjectPropertyInstance_Tests.cs (1)
69Assert.Throws<ArgumentNullException>(() =>
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (4)
166Assert.Throws<ArgumentException>(() => 183Assert.Throws<ArgumentException>(() => 203Assert.Throws<ArgumentException>(() => 221Assert.Throws<ArgumentException>(() =>
Microsoft.Build.Engine.UnitTests (230)
AssemblyNameEx_Tests.cs (2)
327Assert.Throws<FileLoadException>(() => 339Assert.Throws<FileLoadException>(() =>
BackEnd\AssemblyTaskFactory_Tests.cs (8)
56Assert.Throws<ArgumentNullException>(() => 68Assert.Throws<InvalidProjectFileException>(() => 80Assert.Throws<InvalidProjectFileException>(() => 92Assert.Throws<InvalidProjectFileException>(() => 106Assert.Throws<InternalErrorException>(() => 120Assert.Throws<InternalErrorException>(() => 152Assert.Throws<InvalidProjectFileException>(() => 163Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\BatchingEngine_Tests.cs (2)
161Assert.Throws<InvalidProjectFileException>(() => 198Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\BuildEventArgTransportSink_Tests.cs (2)
41Assert.Throws<InternalErrorException>(() => 52Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildManager_Tests.cs (6)
113Assert.Throws<ArgumentNullException>(() => { new BuildParameters(null); }); 1139Assert.Throws<InvalidOperationException>(() => 1178Assert.Throws<InvalidOperationException>(() => _buildManager.BeginBuild(new BuildParameters())); 1209Assert.Throws<InvalidOperationException>(() => _buildManager.EndBuild()); 1250Assert.Throws<InvalidOperationException>(() => { _buildManager.Build(new BuildParameters(), data); }); 1312Assert.Throws<InvalidOperationException>(() => _buildManager.EndBuild());
BackEnd\BuildRequest_Tests.cs (3)
30Assert.Throws<ArgumentNullException>(() => 99Assert.Throws<InternalErrorException>(() => 109Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildRequestConfiguration_Tests.cs (8)
42Assert.Throws<ArgumentNullException>(() => 50Assert.Throws<ArgumentNullException>(() => 64Assert.Throws<InternalErrorException>(() => 88Assert.Throws<ArgumentNullException>(() => 97Assert.Throws<ArgumentNullException>(() => 137Assert.Throws<InternalErrorException>(() => 497var exception = Assert.Throws<InternalErrorException>( 507var exception = Assert.Throws<InternalErrorException>(
BackEnd\BuildRequestEntry_Tests.cs (5)
35Assert.Throws<ArgumentNullException>(() => 179Assert.Throws<InternalErrorException>(() => 195Assert.Throws<InternalErrorException>(() => 212Assert.Throws<InternalErrorException>(() => 236Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildResult_Tests.cs (8)
62Assert.Throws<NullReferenceException>(() => 137Assert.Throws<KeyNotFoundException>(() => 148Assert.Throws<KeyNotFoundException>(() => 160Assert.Throws<ArgumentNullException>(() => 171Assert.Throws<ArgumentNullException>(() => 182Assert.Throws<ArgumentNullException>(() => 217Assert.Throws<ArgumentNullException>(() => 230Assert.Throws<InternalErrorException>(() =>
BackEnd\CentralForwardingLogger_Tests.cs (2)
55Assert.Throws<InternalErrorException>(() => 68Assert.Throws<InternalErrorException>(() =>
BackEnd\ConfigurationMetadata_Tests.cs (2)
38Assert.Throws<ArgumentNullException>(() => 50Assert.Throws<ArgumentNullException>(() =>
BackEnd\EventRedirectorToSink_Tests.cs (3)
24Assert.Throws<InternalErrorException>(() => 37Assert.Throws<InternalErrorException>(() => 82Assert.Throws<InternalErrorException>(() =>
BackEnd\EventSourceSink_Tests.cs (1)
125Assert.Throws<InternalErrorException>(() =>
BackEnd\FullyQualifiedBuildRequest_Tests.cs (2)
31Assert.Throws<ArgumentNullException>(() => 40Assert.Throws<ArgumentNullException>(() =>
BackEnd\IntrinsicTask_Tests.cs (10)
87Assert.Throws<InvalidProjectFileException>(() => 105Assert.Throws<InvalidProjectFileException>(() => 143Assert.Throws<InvalidProjectFileException>(() => 160Assert.Throws<InvalidProjectFileException>(() => 664Assert.Throws<InvalidProjectFileException>(() => 758Assert.Throws<InvalidProjectFileException>(() => 774Assert.Throws<InvalidProjectFileException>(() => 792Assert.Throws<InvalidProjectFileException>(() => 1604Assert.Throws<InvalidProjectFileException>(() => 3006Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\LoggingContext_Tests.cs (1)
60Assert.Throws<InternalErrorException>(() =>
BackEnd\LoggingService_Tests.cs (15)
117Assert.Throws<InternalErrorException>(() => 129Assert.Throws<InternalErrorException>(() => 189Assert.Throws<InternalErrorException>(() => 204Assert.Throws<InternalErrorException>(() => 216Assert.Throws<InternalErrorException>(() => 230Assert.Throws<LoggerException>(() => 243Assert.Throws<InternalLoggerException>(() => 256Assert.Throws<StackOverflowException>(() => 319Assert.Throws<InternalErrorException>(() => 331Assert.Throws<InternalErrorException>(() => 502Assert.Throws<InternalErrorException>(() => 513Assert.Throws<InternalErrorException>(() => 524Assert.Throws<InternalErrorException>(() => 673Assert.Throws<InternalErrorException>(() => 686Assert.Throws<InternalErrorException>(() =>
BackEnd\LoggingServicesLogMethod_Tests.cs (33)
53Assert.Throws<InternalErrorException>(() => 103Assert.Throws<InternalErrorException>(() => 116Assert.Throws<InternalErrorException>(() => 153Assert.Throws<InternalErrorException>(() => 166Assert.Throws<InternalErrorException>(() => 214Assert.Throws<InternalErrorException>(() => 227Assert.Throws<InternalErrorException>(() => 258Assert.Throws<InternalErrorException>(() => 272Assert.Throws<InternalErrorException>(() => 332Assert.Throws<InternalErrorException>(() => 373Assert.Throws<InternalErrorException>(() => 386Assert.Throws<InternalErrorException>(() => 399Assert.Throws<InternalErrorException>(() => 509Assert.Throws<InternalErrorException>(() => 523Assert.Throws<InternalErrorException>(() => 567Assert.Throws<InternalErrorException>(() => 580Assert.Throws<InternalErrorException>(() => 607Assert.Throws<InternalErrorException>(() => 620Assert.Throws<InternalErrorException>(() => 633Assert.Throws<InternalErrorException>(() => 677Assert.Throws<InternalErrorException>(() => 690Assert.Throws<InternalErrorException>(() => 730Assert.Throws<InternalErrorException>(() => 753Assert.Throws<InternalErrorException>(() => 793Assert.Throws<InternalErrorException>(() => 807Assert.Throws<InternalErrorException>(() => 911Assert.Throws<InternalErrorException>(() => 976Assert.Throws<InternalErrorException>(() => 1094Assert.Throws<InternalErrorException>(() => 1129Assert.Throws<InternalErrorException>(() => 1169Assert.Throws<InternalErrorException>(() => 1217Assert.Throws<InternalErrorException>(() => 1256InternalErrorException exception = Assert.Throws<InternalErrorException>(() =>
BackEnd\Lookup_Tests.cs (1)
1012Assert.Throws<InternalErrorException>(() =>
BackEnd\NodeEndpointInProc_Tests.cs (2)
186Assert.Throws<ArgumentNullException>(() => 196Assert.Throws<ArgumentNullException>(() =>
BackEnd\NodePackets_Tests.cs (1)
35Assert.Throws<InternalErrorException>(() =>
BackEnd\OnError_Tests.cs (1)
556Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\ResultsCache_Tests.cs (1)
141Assert.Throws<InternalErrorException>(() =>
BackEnd\TargetEntry_Tests.cs (5)
80Assert.Throws<ArgumentNullException>(() => 95Assert.Throws<ArgumentNullException>(() => 109Assert.Throws<ArgumentNullException>(() => 136Assert.Throws<InternalErrorException>(() => 150Assert.Throws<InternalErrorException>(() =>
BackEnd\TargetResult_Tests.cs (1)
53Assert.Throws<ArgumentNullException>(() =>
BackEnd\TaskExecutionHost_Tests.cs (7)
157Assert.Throws<InvalidProjectFileException>(() => 490Assert.Throws<InvalidProjectFileException>(() => 640Assert.Throws<IndexOutOfRangeException>(() => 930Assert.Throws<InvalidProjectFileException>(() => 941Assert.Throws<InvalidProjectFileException>(() => 952Assert.Throws<InvalidProjectFileException>(() => 979Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\TaskHost_Tests.cs (8)
236Assert.Throws<ArgumentNullException>(() => 247Assert.Throws<ArgumentNullException>(() => 258Assert.Throws<ArgumentNullException>(() => 269Assert.Throws<ArgumentNullException>(() => 765Assert.Throws<ArgumentOutOfRangeException>(() => 770Assert.Throws<ArgumentOutOfRangeException>(() => 805Assert.Throws<ArgumentOutOfRangeException>(() => 810Assert.Throws<ArgumentOutOfRangeException>(() =>
BackEnd\TaskHostConfiguration_Tests.cs (3)
40Assert.Throws<InternalErrorException>(() => 75Assert.Throws<InternalErrorException>(() => 110Assert.Throws<InternalErrorException>(() =>
BackEnd\TaskRegistry_Tests.cs (8)
1375Assert.Throws<InvalidProjectFileException>(() => 1417Assert.Throws<InvalidProjectFileException>(() => 1459Assert.Throws<InvalidProjectFileException>(() => 1481Assert.Throws<InvalidProjectFileException>(() => 1552Assert.Throws<InvalidProjectFileException>(() => 1600Assert.Throws<InvalidProjectFileException>(() => 1647Assert.Throws<InvalidProjectFileException>(() => 1807Assert.Throws<InvalidProjectFileException>(() =>
Collections\MSBuildNameIgnoreCaseComparer_Tests.cs (3)
83Assert.Throws<InternalErrorException>(() => 94Assert.Throws<InternalErrorException>(() => 105Assert.Throws<InternalErrorException>(() =>
Collections\OMcollections_tests.cs (1)
241Assert.Throws<InternalErrorException>(() =>
Construction\ElementLocation_Tests.cs (6)
212Assert.Throws<InternalErrorException>(() => 223Assert.Throws<InternalErrorException>(() => 350Assert.Throws<InvalidOperationException>(() => 370Assert.Throws<InvalidOperationException>(() => 387Assert.Throws<InvalidOperationException>(() => 406Assert.Throws<InvalidOperationException>(() =>
Construction\SolutionProjectGenerator_Tests.cs (1)
2304Assert.Throws<InvalidProjectFileException>(() =>
CopyOnWriteDictionary_Tests.cs (1)
46Assert.Throws<KeyNotFoundException>(() =>
Definition\ItemDefinitionGroup_Tests.cs (7)
163Assert.Throws<InvalidProjectFileException>(() => 192Assert.Throws<InvalidProjectFileException>(() => 220Assert.Throws<InvalidProjectFileException>(() => 812Assert.Throws<InvalidProjectFileException>(() => 831Assert.Throws<InvalidProjectFileException>(() => 847Assert.Throws<InvalidProjectFileException>(() => 1059Assert.Throws<InvalidProjectFileException>(() =>
Definition\Toolset_Tests.cs (3)
26Assert.Throws<ArgumentNullException>(() => 35Assert.Throws<ArgumentNullException>(() => 44Assert.Throws<ArgumentException>(() =>
Definition\ToolsetConfigurationReader_Tests.cs (9)
202Assert.Throws<ConfigurationErrorsException>(() => 230Assert.Throws<ConfigurationErrorsException>(() => 258Assert.Throws<ConfigurationErrorsException>(() => 325Assert.Throws<ConfigurationErrorsException>(() => 350Assert.Throws<ConfigurationErrorsException>(() => 375Assert.Throws<ConfigurationErrorsException>(() => 401Assert.Throws<ConfigurationErrorsException>(() => 601Assert.Throws<ConfigurationErrorsException>(() => 636Assert.Throws<ConfigurationErrorsException>(() =>
Definition\ToolsVersion_Tests.cs (1)
404Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\Evaluator_Tests.cs (4)
955InvalidProjectFileException ex = Assert.Throws<InvalidProjectFileException>(() => 1030Assert.Throws<InvalidProjectFileException>(() => 3123Assert.Throws<InvalidProjectFileException>(() => 4535InvalidProjectFileException ex = Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\Expander_Tests.cs (15)
1758Assert.Throws<InvalidProjectFileException>(() => 1775Assert.Throws<InvalidProjectFileException>(() => 2349Assert.Throws<InvalidProjectFileException>(() => 2367Assert.Throws<InvalidProjectFileException>(() => 2384Assert.Throws<InvalidProjectFileException>(() => 2401Assert.Throws<InvalidProjectFileException>(() => 2419Assert.Throws<InvalidProjectFileException>(() => 2435Assert.Throws<InvalidProjectFileException>(() => 2451Assert.Throws<InvalidProjectFileException>(() => 2467Assert.Throws<InvalidProjectFileException>(() => 3451InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 3467InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 3629Assert.Throws<InvalidProjectFileException>(() => 4526Assert.Throws<InvalidProjectFileException>(() => 4602Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\ProjectRootElementCache_Tests.cs (2)
50Assert.Throws<InternalErrorException>(() => 61Assert.Throws<InternalErrorException>(() =>
Evaluation\ProjectSdkImplicitImport_Tests.cs (2)
296InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 412InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() =>
FileLogger_Tests.cs (4)
84Assert.Throws<LoggerException>(() => 172Assert.Throws<LoggerException>(() => 186Assert.Throws<LoggerException>(() => 531Assert.Throws<LoggerException>(() =>
FileUtilities_Tests.cs (12)
156Assert.Throws<InvalidOperationException>(() => 167Assert.Throws<InvalidOperationException>(() => 294Assert.Throws<ArgumentException>(() => 425Assert.Throws<PathTooLongException>(() => 450Assert.Throws<ArgumentNullException>(() => 459Assert.Throws<ArgumentException>(() => 468Assert.Throws<ArgumentException>(() => 477Assert.Throws<ArgumentException>(() => 486Assert.Throws<ArgumentException>(() => 529Assert.Throws<ArgumentException>(() => 860Assert.Throws<IOException>(() => 874Assert.Throws<IOException>(() =>
Instance\HostServices_Tests.cs (6)
60Assert.Throws<ArgumentNullException>(() => 73Assert.Throws<ArgumentNullException>(() => 86Assert.Throws<ArgumentNullException>(() => 217Assert.Throws<InvalidOperationException>(() => 232Assert.Throws<InvalidOperationException>(() => 274Assert.Throws<InvalidOperationException>(() =>
Utilities_Tests.cs (2)
150Assert.Throws<InvalidProjectFileException>(() => 167Assert.Throws<InvalidProjectFileException>(() =>
Microsoft.Build.Tasks.UnitTests (16)
AssemblyNameEx_Tests.cs (2)
327Assert.Throws<FileLoadException>(() => 339Assert.Throws<FileLoadException>(() =>
CommandLineBuilderExtension_Tests.cs (1)
28Assert.Throws<ArgumentException>(() =>
FileStateTests.cs (3)
23Assert.Throws<ArgumentException>(() => 44Assert.Throws<ArgumentException>(() => { var time = state.LastWriteTime; }); 393Assert.Throws<FileNotFoundException>(() =>
GetInstalledSDKLocations_Tests.cs (2)
170Assert.Throws<ArgumentNullException>(() => 184Assert.Throws<ArgumentNullException>(() =>
ResolveSDKReference_Tests.cs (2)
1435Assert.Throws<ArgumentNullException>(() => 1451Assert.Throws<ArgumentNullException>(() =>
StreamMappedString_Tests.cs (4)
135Assert.Throws<ArgumentOutOfRangeException>(() => 221Assert.Throws<ArgumentOutOfRangeException>(() => 234Assert.Throws<ArgumentOutOfRangeException>(() => 246Assert.Throws<ArgumentOutOfRangeException>(() =>
ToolTaskExtension_Tests.cs (1)
58Assert.Throws<ArgumentException>(() =>
XslTransformation_Tests.cs (1)
606Assert.Throws<System.ArgumentNullException>(() =>
Microsoft.Build.UnitTests.Shared (1)
ObjectModelHelpers.cs (1)
1919Assert.Throws<InvalidOperationException>(method);
Microsoft.Build.Utilities.UnitTests (1)
MuxLogger_Tests.cs (1)
69Assert.Throws<InvalidOperationException>(() =>
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
Workspaces\WorkspaceTests_EditorFeatures.cs (5)
136Assert.Throws<ArgumentException>(() => workspace.OnProjectRemoved(project.Id)); 150Assert.Throws<ArgumentException>(() => workspace.OnProjectRemoved(project2.Id)); 267Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project1.Id, new ProjectReference(project2.Id))); 306Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project1.Id, new ProjectReference(project2.Id))); 345Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project2.Id, new ProjectReference(project1.Id)));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (15)
Semantics\AccessCheckTests.cs (6)
767Assert.Throws<ArgumentNullException>(() => { compilation.IsSymbolAccessibleWithin(classA, nullSymbol); }); 768Assert.Throws<ArgumentNullException>(() => { compilation.IsSymbolAccessibleWithin(nullSymbol, classA); }); 769Assert.Throws<ArgumentException>(() => { compilation.IsSymbolAccessibleWithin(classA, pubField); }); 861Assert.Throws<ArgumentException>(() => { compilation.IsSymbolAccessibleWithin(classA, classOther); }); 945Assert.Throws<ArgumentException>(() => { compilation3.IsSymbolAccessibleWithin(Outer, InOtherCompilation); }); 946Assert.Throws<ArgumentException>(() => { compilation3.IsSymbolAccessibleWithin(Outer, InFriendCompilation); });
Semantics\SyntaxTreeRootTests.cs (5)
113Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.GetCompilationUnitRoot(); }); 114Assert.Throws<ArgumentNullException>(() => { tree.GetDiagnostics((CSharpSyntaxNode)null); }); 115Assert.Throws<InvalidOperationException>(() => { tree.GetDiagnostics(default(SyntaxToken)); }); 116Assert.Throws<ArgumentNullException>(() => { tree.GetDiagnostics((SyntaxNode)null); }); 117Assert.Throws<InvalidOperationException>(() => { tree.GetDiagnostics(default(SyntaxTrivia)); });
SourceGeneration\SyntaxAwareGeneratorTests.cs (4)
188Assert.Throws<InvalidOperationException>(() => 196Assert.Throws<InvalidOperationException>(() => 204Assert.Throws<InvalidOperationException>(() => 212Assert.Throws<InvalidOperationException>(() =>
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (29)
Compilation\CompilationAPITests.cs (19)
1324Assert.Throws<NullReferenceException>( 1385Assert.Throws<ArgumentNullException>( 1454Assert.Throws<ArgumentException>( 1461Assert.Throws<ArgumentNullException>( 1475Assert.Throws<ArgumentException>( 1483Assert.Throws<ArgumentException>( 1510Assert.Throws<ArgumentOutOfRangeException>( 1516Assert.Throws<ArgumentOutOfRangeException>( 1522Assert.Throws<ArgumentOutOfRangeException>( 1528Assert.Throws<ArgumentOutOfRangeException>( 1542Assert.Throws<ArgumentException>( 1566Assert.Throws<ArgumentNullException>( 1573Assert.Throws<ArgumentNullException>( 1585Assert.Throws<ArgumentNullException>( 1602Exception invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1607invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1612invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1620Assert.Throws<ArgumentException>( 2386Assert.Throws<ArgumentException>(() =>
Compilation\ReferenceManagerTests.cs (1)
1327Assert.Throws<TestException>(() => { var a = c.Assembly; });
Compilation\SemanticModelAPITests.cs (1)
647Assert.Throws<ArgumentException>(() =>
Compilation\SymbolSearchTests.cs (8)
20Assert.Throws<ArgumentException>(() => 26Assert.Throws<ArgumentException>(() => 32Assert.Throws<ArgumentException>(() => 38Assert.Throws<ArgumentException>(() => 48Assert.Throws<ArgumentNullException>(() => 54Assert.Throws<ArgumentNullException>(() => 64Assert.Throws<ArgumentNullException>(() => 70Assert.Throws<ArgumentNullException>(() =>
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (5)
LexicalAndXml\SyntaxTokenParserTests.cs (1)
206Assert.Throws<ArgumentOutOfRangeException>(() => parser.SkipForwardTo(0));
Syntax\StructuredTriviaTests.cs (3)
197Assert.Throws<System.ArgumentOutOfRangeException>(delegate 202Assert.Throws<System.ArgumentOutOfRangeException>(delegate 208Assert.Throws<System.ArgumentOutOfRangeException>(delegate
Syntax\SyntaxNodeTests.cs (1)
3624Assert.Throws<System.ArgumentNullException>(delegate
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (6)
MetadataShadowCopyProviderTests.cs (6)
63Assert.Throws<ArgumentNullException>(() => _provider.SuppressShadowCopy(null)); 64Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("c:goo.dll")); 65Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("bar.dll")); 66Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"\bar.dll")); 67Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"../bar.dll")); 161Assert.Throws<IOException>(() => File.Delete(sc));
Microsoft.CodeAnalysis.UnitTests (97)
AnalyzerAssemblyLoaderTests.cs (1)
1501Assert.Throws<UnauthorizedAccessException>(() => File.Delete(testFixture.Delta1));
Collections\HashSet\ISet_Generic_Tests`1.cs (8)
323Assert.Throws<ArgumentNullException>(() => set.ExceptWith(null!)); 324Assert.Throws<ArgumentNullException>(() => set.IntersectWith(null!)); 325Assert.Throws<ArgumentNullException>(() => set.SymmetricExceptWith(null!)); 326Assert.Throws<ArgumentNullException>(() => set.UnionWith(null!)); 331Assert.Throws<NotSupportedException>(() => set.ExceptWith(null!)); 332Assert.Throws<NotSupportedException>(() => set.IntersectWith(null!)); 333Assert.Throws<NotSupportedException>(() => set.SymmetricExceptWith(null!)); 334Assert.Throws<NotSupportedException>(() => set.UnionWith(null!));
Collections\IdentifierCollectionTests.cs (2)
81Assert.Throws<NotSupportedException>(() => collection.Add("x")); 83Assert.Throws<NotSupportedException>(() => collection.Clear());
Collections\ImmutableDictionaryTestBase.cs (6)
131Assert.Throws<NotSupportedException>(() => dictionary.Add(new KeyValuePair<string, int>())); 133Assert.Throws<NotSupportedException>(() => dictionary.Clear()); 157Assert.Throws<NotSupportedException>(() => dictionary.Add("a", 1)); 168Assert.Throws<NotSupportedException>(() => dictionary.Add("a", 1)); 169Assert.Throws<NotSupportedException>(() => dictionary.Remove("a")); 171Assert.Throws<NotSupportedException>(() => dictionary.Clear());
Collections\ImmutableDictionaryTestBase.nonnetstandard.cs (3)
57Assert.Throws<NotSupportedException>(() => map.Add(5, 3)); 290Assert.Throws<NotSupportedException>(() => collection.Add(default(T)!)); 291Assert.Throws<NotSupportedException>(() => collection.Clear());
Collections\ImmutableSegmentedListTest.cs (8)
749Assert.Throws<NotSupportedException>(() => list.Clear()); 750Assert.Throws<NotSupportedException>(() => list.Insert(0, 1)); 751Assert.Throws<NotSupportedException>(() => list.Remove(1)); 752Assert.Throws<NotSupportedException>(() => list.RemoveAt(0)); 761Assert.Throws<NotSupportedException>(() => list.Add(1)); 762Assert.Throws<NotSupportedException>(() => list.Clear()); 763Assert.Throws<NotSupportedException>(() => list.Insert(0, 1)); 765Assert.Throws<NotSupportedException>(() => list.RemoveAt(0));
Collections\ImmutableSetTest.cs (6)
173Assert.Throws<NotSupportedException>(() => set.ExceptWith(null!)); 174Assert.Throws<NotSupportedException>(() => set.UnionWith(null!)); 175Assert.Throws<NotSupportedException>(() => set.IntersectWith(null!)); 176Assert.Throws<NotSupportedException>(() => set.SymmetricExceptWith(null!)); 183Assert.Throws<NotSupportedException>(() => set.Add(1)); 184Assert.Throws<NotSupportedException>(() => set.Clear());
Collections\List\ICollection.Generic.Tests.cs (8)
284Assert.Throws<NotSupportedException>(() => collection.Add(CreateT(0))); 317Assert.Throws<NotSupportedException>(() => collection.Clear()); 334Assert.Throws<NotSupportedException>(() => collection.Clear()); 335Assert.Throws<NotSupportedException>(() => collection.Clear()); 336Assert.Throws<NotSupportedException>(() => collection.Clear()); 483Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null!, 0)); 492Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, -1)); 493Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, int.MinValue));
Collections\List\ICollection.NonGeneric.Tests.cs (5)
182Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null!, 0)); 252Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, -1)); 253Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, int.MinValue)); 263Assert.Throws<ArgumentException>(() => collection.CopyTo(array, count)); 286Assert.Throws<ArgumentException>(() => collection.CopyTo(array, 1));
Collections\List\IEnumerable.Generic.Tests.cs (8)
184Assert.Throws<InvalidOperationException>( 728Assert.Throws<NotSupportedException>(() => enumerator.Reset()); 745Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 788Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 832Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 870Assert.Throws<NotSupportedException>( 887Assert.Throws<NotSupportedException>( 903Assert.Throws<NotSupportedException>(
Collections\List\IEnumerable.NonGeneric.Tests.cs (4)
366Assert.Throws<NotSupportedException>(() => enumerator.Reset()); 381Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 407Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 430Assert.Throws<InvalidOperationException>(() => enumerator.Reset());
Collections\List\IList.Generic.Tests.cs (10)
406Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, validAdd)); 407Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(int.MinValue, validAdd)); 433Assert.Throws<NotSupportedException>(() => list.Insert(count / 2, CreateT(321432))); 506Assert.Throws<NotSupportedException>(() => list.Insert(0, value)); 528Assert.Throws<ArgumentException>(() => list.Insert(count / 2, value)); 545Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(-1)); 546Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(int.MinValue)); 559Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(count)); 560Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(count + 1)); 572Assert.Throws<NotSupportedException>(() => list.RemoveAt(count / 2));
Collections\List\IList.NonGeneric.Tests.cs (7)
544Assert.Throws<NotSupportedException>(() => collection.Clear()); 766Assert.Throws<NotSupportedException>(() => list.Insert(count / 2, CreateT(321432))); 854Assert.Throws<ArgumentException>(() => list.Insert(count / 2, value)); 870Assert.Throws<NotSupportedException>(() => collection.Remove(CreateT(34543))); 908Assert.Throws<ArgumentException>(() => list.Remove(value)); 999Assert.Throws<ArgumentException>(() => collection.Remove(value)); 1044Assert.Throws<NotSupportedException>(() => list.RemoveAt(count / 2));
Collections\List\SegmentedList.Generic.Tests.Misc.cs (1)
115Assert.Throws<ArgumentOutOfRangeException>(() => _ilist.Insert(bad[i], items[0])); //"ArgumentOutOfRangeException expected."
Collections\TestExtensionsMethods.cs (1)
20Assert.Throws<NullReferenceException>(a);
FileLinePositionSpanTests.cs (3)
35Assert.Throws<ArgumentNullException>( 41Assert.Throws<ArgumentException>( 47Assert.Throws<ArgumentException>(
LinePositionTests.cs (2)
31Assert.Throws<ArgumentOutOfRangeException>( 38Assert.Throws<ArgumentOutOfRangeException>(
MetadataReferences\AssemblyIdentityTests.cs (1)
81Assert.Throws<ArgumentNullException>(() => { AssemblyIdentity.FromAssemblyDefinition(asm); });
MetadataReferences\ModuleMetadataTests.cs (4)
24Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, 0); }); 25Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, -1); }); 90Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, 0); }); 91Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, -1); });
Text\StringTextTest.cs (1)
84Assert.Throws<IndexOutOfRangeException>(
Text\StringTextTests_Default.cs (1)
50Assert.Throws<IndexOutOfRangeException>(
Text\TextChangeRangeTest.cs (1)
19Assert.Throws<ArgumentOutOfRangeException>(
Text\TextChangeTests.cs (6)
220Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(-1, destination, 0, 2)); 221Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, -1, 2)); 222Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, 0, -1)); 223Assert.Throws<ArgumentNullException>(() => newText.CopyTo(0, null, 0, 2)); 224Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(newText.Length - 1, destination, 0, 2)); 225Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, destination.Length - 1, 2));
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (11)
CodeGen\CodeGenTuples.vb (11)
6866Assert.Throws(Of ArgumentNullException)(Sub() comp.CreateTupleTypeSymbol(underlyingType:=Nothing, elementNames:=Nothing)) 7220Assert.Throws(Of ArgumentNullException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=Nothing, elementNames:=Nothing)) 7223Assert.Throws(Of ArgumentException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=ImmutableArray(Of ITypeSymbol).Empty, elementNames:=Nothing)) 7224Assert.Throws(Of ArgumentException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=ImmutableArray.Create(intType), elementNames:=Nothing)) 7227Assert.Throws(Of ArgumentException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=ImmutableArray.Create(intType, intType), elementNames:=ImmutableArray.Create("Item1"))) 7230Assert.Throws(Of ArgumentNullException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=ImmutableArray.Create(intType, Nothing), elementNames:=Nothing)) 7483Assert.Throws(Of ArgumentException)(Sub() comp.CreateTupleTypeSymbol(ImmutableArray.Create(stringType, csType), Nothing)) 8940Assert.Throws(Of ArgumentNullException)(Sub() comp.CreateErrorTypeSymbol(Nothing, Nothing, 2)) 8941Assert.Throws(Of ArgumentException)(Sub() comp.CreateErrorTypeSymbol(Nothing, "a", -1)) 8944Assert.Throws(Of ArgumentNullException)(Sub() comp.CreateErrorNamespaceSymbol(Nothing, "a")) 14851Assert.Throws(Of ArgumentNullException)(Sub() Compilation.GetRequiredLanguageVersion(Nothing))
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (7)
ObjectFormatterTests.vb (2)
88Assert.Throws(Of ArgumentException)(Sub() primitiveFormatter.TestEscapeStringWithoutQuotes()) 89Assert.Throws(Of ArgumentException)(Sub() primitiveFormatter.TestEscapeCharWithoutQuotes())
PrintOptionsTests.vb (5)
18Assert.Throws(Of ArgumentNullException)(Sub() s_formatter.FormatObject("hello", options:=Nothing)) 23Assert.Throws(Of ArgumentOutOfRangeException)( 32Assert.Throws(Of ArgumentOutOfRangeException)( 41Assert.Throws(Of ArgumentOutOfRangeException)( 46Assert.Throws(Of ArgumentOutOfRangeException)(
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (3)
FlowAnalysis\IterationJumpYieldStatementTests.vb (1)
1305Xunit.Assert.Throws(Of ArgumentException)(
Semantics\QueryExpressions_FlowAnalysis.vb (2)
897Assert.Throws(Of System.ArgumentException)( 1099Assert.Throws(Of System.ArgumentException)(
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
2204Assert.Throws<NotSupportedException>(delegate 2214Assert.Throws<NotSupportedException>(delegate
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
CommandLineProject\CommandLineProjectTests.cs (1)
37Assert.Throws<InvalidOperationException>(delegate
ObjectSerializationTests.cs (4)
243Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(uint.MaxValue)); // max uint not allowed 244Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0x80000000u)); // highest bit set not allowed 245Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0x40000000u)); // second highest bit set not allowed 246Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0xC0000000u)); // both high bits set not allowed
UtilityTest\AsyncLazyTests.cs (1)
248var thrownException = Assert.Throws<OperationCanceledException>(() =>
Microsoft.Data.Analysis.Tests (9)
DataFrame.IOTests.cs (1)
1079Assert.Throws<ArgumentException>(() => DataFrame.SaveCsv(dataFrame, csvStream, separator: separator, cultureInfo: cultureInfo));
DataFrameTests.cs (7)
78Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, bigColumn)); 79Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(bigColumn)); 83Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, smallColumn)); 84Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(smallColumn)); 88Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, repeatedName)); 93Assert.Throws<ArgumentOutOfRangeException>(() => dataFrame.Columns.Insert(columnCount + 1, repeatedName)); 806Assert.Throws<ArgumentException>(() => df.Columns.Insert(1, new Int32DataFrameColumn("Int2", Enumerable.Range(0, 5).Select(x => x))));
TextFieldParserTests.cs (1)
113Assert.Throws<ArgumentException>(() => parser.SetFieldWidths(new[] { -1, -1 }));
Microsoft.DotNet.Build.Tasks.Workloads.Tests (1)
SwixPackageTests.cs (1)
28Exception e = Assert.Throws<Exception>(() =>
Microsoft.DotNet.RemoteExecutor.Tests (3)
RemoteExecutorTests.cs (3)
26Assert.Throws<RemoteExecutionException>(() => 51Assert.Throws<RemoteExecutionException>(() => 64Assert.Throws<RemoteExecutionException>(() =>
Microsoft.DotNet.XUnitAssert.Tests (8)
ExceptionAssertsTests.cs (6)
175 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!)); 183 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 199 Assert.Throws<ArgumentException>(testCode); 208 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 226 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 327 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!));
IdentityAssertsTests.cs (1)
55 Assert.Throws<SameException>(() => Assert.Same(0, 0));
SetAssertsTests.cs (1)
334 var ex = Assert.Throws<SupersetException>(() => Assert.Superset(expectedSuperset, actual));
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (1)
RedisCacheSetAndRemoveTests.cs (1)
99Assert.Throws<ArgumentNullException>(() => cache.Set(key, value));
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
KubernetesProbesOptionsValidatorTests.cs (1)
115Assert.Throws<OptionsValidationException>(action);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Windows\WindowsCountersTests.cs (1)
99Assert.Throws<AggregateException>(() =>
Microsoft.Extensions.Diagnostics.Testing.Tests (3)
Metrics\MetricCollectorTests.cs (3)
362Assert.Throws<ObjectDisposedException>(() => collector.Clear()); 364Assert.Throws<ObjectDisposedException>(() => collector.RecordObservableInstruments()); 379Assert.Throws<ObjectDisposedException>(() => collector.Clear());
Microsoft.Extensions.Http.Resilience.Tests (5)
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (4)
107Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, _validConfigurationSection, options => { })); 117Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, _validConfigurationSection, null!)); 128Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, null!, options => { })); 138Assert.Throws<ArgumentException>(() => AddStandardResilienceHandler(mode, builder, _emptyConfigurationSection, options => { }));
Resilience\HttpResilienceContextExtensionsTests.cs (1)
54Assert.Throws<ArgumentNullException>(() => context.SetRequestMessage(request));
Microsoft.Extensions.Localization.Tests (1)
ResourceManagerStringLocalizerTest.cs (1)
194var exception = Assert.Throws<MissingManifestResourceException>(() =>
Microsoft.Extensions.SecretManager.Tools.Tests (1)
InitCommandTest.cs (1)
138Assert.Throws<ArgumentException>(() =>
Microsoft.Extensions.Telemetry.Tests (2)
Logging\ExtendedLoggerFactoryTests.cs (2)
25Assert.Throws<ObjectDisposedException>(() => factory.AddProvider(CreateProvider())); 33Assert.Throws<ArgumentNullException>(() => factory.AddProvider(null!));
Microsoft.Extensions.TimeProvider.Testing.Tests (2)
FakeTimeProviderTests.cs (2)
156Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.Advance(TimeSpan.FromTicks(-1))); 157Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.SetUtcNow(timeProvider.GetUtcNow() - TimeSpan.FromTicks(1)));
Microsoft.JSInterop.Tests (4)
Infrastructure\DotNetDispatcherTest.cs (4)
42var ex = Assert.Throws<ArgumentException>(() => 64var ex = Assert.Throws<ArgumentException>(() => 551var ex = Assert.Throws<ArgumentException>(() => 574var ex = Assert.Throws<JsonException>(() =>
Microsoft.ML.AutoML.Tests (1)
ColumnInferenceTests.cs (1)
48Assert.Throws<ArgumentException>(new System.Action(() => context.Auto().InferColumns(dataPath, "Junk", groupColumns: false)));
Microsoft.ML.Tests (9)
CachingTests.cs (1)
67var ex = Assert.Throws<InvalidOperationException>(() => CacheOnEmptyEstimatorChain());
DatabaseLoaderTests.cs (1)
46var ex = Assert.Throws<System.Reflection.TargetInvocationException>(() => IrisLightGbmImpl(dbs));
ImagesTests.cs (1)
1302Assert.Throws<ArgumentException>(() => image1.Save(imageTempPath));
Scenarios\Api\TestApi.cs (1)
263Assert.Throws<InvalidOperationException>(() => idv.Schema[1].Annotations.GetValue(kindFloat, ref retrievedReadOnlyMemoryVBuffer));
SvmLightTests.cs (5)
236var ex = Assert.Throws<InvalidOperationException>(() => 507var ex = Assert.Throws<InvalidOperationException>(() => 515ex = Assert.Throws<InvalidOperationException>(() => 523ex = Assert.Throws<InvalidOperationException>(() => 531ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.Net.Http.Headers.Tests (17)
CacheControlHeaderValueTest.cs (5)
46Assert.Throws<ArgumentException>(() => cacheControl.NoCacheHeaders.Add(null)); 47Assert.Throws<FormatException>(() => cacheControl.NoCacheHeaders.Add("invalid PLACEHOLDER")); 53Assert.Throws<ArgumentException>(() => cacheControl.PrivateHeaders.Add(null)); 54Assert.Throws<FormatException>(() => cacheControl.PrivateHeaders.Add("invalid PLACEHOLDER")); 61Assert.Throws<ArgumentNullException>(() => cacheControl.Extensions.Add(null!));
ContentDispositionHeaderValueTest.cs (1)
59Assert.Throws<ArgumentNullException>(() => contentDisposition.Parameters.Add(null!));
HeaderUtilitiesTest.cs (2)
287Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString(input); }); 293Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString($"{(char)0x7F}"); });
MediaTypeHeaderValueTest.cs (4)
123Assert.Throws<ArgumentNullException>(() => mediaType.Parameters.Add(null!)); 149Assert.Throws<InvalidOperationException>(() => { mediaType1.MediaType = "some/value"; }); 184Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Add(new NameValueHeaderValue("name"))); 186Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Clear());
NameValueHeaderValueTest.cs (5)
89Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; }); 122Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; }); 145Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = " x "; }); 146Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = "x y"; }); 615Assert.Throws<FormatException>(() => header.SetAndEscapeValue(input));
Microsoft.VisualBasic.IntegrationTests (1)
InteractionTests.cs (1)
30_ = Assert.Throws<ArgumentException>(() => Interaction.AppActivate(GetUniqueName())).ToString();
Microsoft.VisualBasic.Tests (20)
Microsoft\VisualBasic\MyServices\FileSystemProxyTests.cs (18)
73Assert.Throws<IOException>(() => _fileSystem.CopyDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory)); 98Assert.Throws<IOException>(() => _fileSystem.CopyDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory, overwrite: false)); 136Assert.Throws<IOException>(() => _fileSystem.CopyFile(testFileSource, testFileDest)); 158Assert.Throws<IOException>(() => _fileSystem.CopyFile(testFileSource, testFileDest, overwrite: false)); 226Assert.Throws<IOException>(() => _fileSystem.DeleteDirectory(FullPathToNewDirectory, DeleteDirectoryOption.ThrowIfDirectoryNonEmpty)); 511Assert.Throws<IOException>(() => _fileSystem.MoveDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory)); 537Assert.Throws<IOException>(() => _fileSystem.MoveDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory, overwrite: false)); 586Assert.Throws<IOException>(() => _fileSystem.MoveFile(SourceFileNameWithPath, DestinationFileNameWithPath)); 603Assert.Throws<IOException>(() => _fileSystem.MoveFile(SourceFileNameWithPath, DestinationFileNameWithPath, overwrite: false)); 641Assert.Throws<DirectoryNotFoundException>(() => _fileSystem.RenameDirectory(Path.Combine(TestDirectory, "DoesNotExistDirectory"), "NewDirectory")); 645Assert.Throws<ArgumentNullException>(() => _fileSystem.RenameDirectory(OrigDirectoryWithPath, "")); 648Assert.Throws<ArgumentException>(() => _fileSystem.RenameDirectory(OrigDirectoryWithPath, DirectoryNameWithPath)); 658Assert.Throws<IOException>(() => _fileSystem.RenameDirectory(NewFDirectoryPath, "OriginalDirectory")); 665Assert.Throws<FileNotFoundException>(() => _fileSystem.RenameFile(Path.Combine(TestDirectory, "DoesNotExistFile"), "NewFile")); 669Assert.Throws<ArgumentNullException>(() => _fileSystem.RenameFile(OrigFileWithPath, "")); 671Assert.Throws<ArgumentException>(() => _fileSystem.RenameFile(OrigFileWithPath, ExistingFileWithPath)); 677Assert.Throws<IOException>(() => _fileSystem.RenameFile(NewFileWithPath, "NewFile")); 679Assert.Throws<IOException>(() => _fileSystem.RenameFile(NewFileWithPath, "NewFDirectory"));
Microsoft\VisualBasic\MyServices\RegistryProxyTests.cs (2)
36Assert.Throws<ArgumentException>(() => registry.SetValue(keyName, valueName, "")); 37Assert.Throws<ArgumentException>(() => registry.SetValue(keyName, valueName, "", Microsoft.Win32.RegistryValueKind.String));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
CodeModel\FileCodeImportTests.cs (2)
35Assert.Throws<COMException>(() => { var value = import.Name; }); 42Assert.Throws<COMException>(() => { var value = import.FullName; });
Security.TransportSecurity.IntegrationTests (6)
Https\ClientCredentialTypeTests.4.1.0.cs (2)
118MessageSecurityException exception = Assert.Throws<MessageSecurityException>(() => 178ArgumentException exception = Assert.Throws<ArgumentException>(() =>
Https\HttpsTests.4.1.0.cs (1)
337Assert.Throws<SecurityNegotiationException>(() => { _ = serviceProxy.Echo(testString); });
Negotiate\NegotiateStream_Http_Tests.4.1.0.cs (1)
85Assert.Throws<System.ServiceModel.ProtocolException>(() => { result = serviceProxy.Echo(testString); });
Tcp\IdentityTests.4.1.1.cs (1)
36var exception = Assert.Throws<MessageSecurityException>(() =>
Tcp\StreamingTests.4.1.0.cs (1)
225Assert.Throws<TimeoutException>(() =>
Shared.Tests (4)
EmptyCollections\EmptyReadonlyDictionaryTests.cs (3)
37Assert.Throws<NotSupportedException>(() => dict.Add(1, "One")); 48Assert.Throws<NotSupportedException>(() => dict.Add(1, "One")); 60Assert.Throws<NotSupportedException>(() => coll.Add(new KeyValuePair<int, string>(1, "One")));
EmptyCollections\EmptyReadOnlyListTests.cs (1)
57Assert.Throws<NotSupportedException>(() => coll.Add(1));
Sockets.BindTests (5)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (5)
556var exception = Assert.Throws<IOException>(() => host.Start()); 591var exception = Assert.Throws<IOException>(() => host.Start()); 758Assert.Throws<InvalidOperationException>(() => host.Start()); 783Assert.Throws<InvalidOperationException>(() => host.Start()); 973var exception = Assert.Throws<IOException>(() => host.Start());
System.Drawing.Common.Tests (188)
mono\System.Drawing\BitmapTests.cs (8)
128Assert.Throws<InvalidOperationException>(() => bmp.SetPixel(0, 0, c)); 137Assert.Throws<InvalidOperationException>(() => bmp.SetPixel(0, 0, c)); 146Assert.Throws<InvalidOperationException>(() => bmp.SetPixel(0, 0, c)); 1148public void SetResolution_Zero() => Assert.Throws<ArgumentException>(() => SetResolution(0.0f, 0.0f)); 1151public void SetResolution_Negative_X() => Assert.Throws<ArgumentException>(() => SetResolution(-1.0f, 1.0f)); 1154public void SetResolution_Negative_Y() => Assert.Throws<ArgumentException>(() => SetResolution(1.0f, -1.0f)); 1163public void SetResolution_NaN() => Assert.Throws<ArgumentException>(() => SetResolution(float.NaN, float.NaN)); 1166public void SetResolution_NegativeInfinity() => Assert.Throws<ArgumentException>(() => SetResolution(float.NegativeInfinity, float.NegativeInfinity));
mono\System.Drawing\GraphicsTests.cs (57)
437Assert.Throws<ArgumentException>(() => g.MultiplyTransform(matrix)); 659Assert.Throws<ArgumentException>(() => g.ScaleTransform(0, 1)); 667Assert.Throws<ArgumentException>(() => g.ScaleTransform(1, 0)); 739Assert.Throws<ArgumentException>(() => g.DrawCurve(Pens.Black, s_tooSmallCurve, 0, 2, 0.5f)); 773Assert.Throws<ArgumentException>(() => g.DrawCurve(Pens.Black, s_smallCurveF, 0, 0)); 781Assert.Throws<ArgumentException>(() => g.DrawCurve(Pens.Black, s_smallCurveF, 0, -1)); 790Assert.Throws<ArgumentException>(() => g.DrawCurve(Pens.Black, s_smallCurveF, 1, 2)); 1057Assert.Throws<ArgumentException>(() => BeginContainer_GraphicsUnit(GraphicsUnit.Display)); 1073Assert.Throws<ArgumentException>(() => BeginContainer_GraphicsUnit(GraphicsUnit.World)); 1079Assert.Throws<ArgumentException>(() => BeginContainer_GraphicsUnit((GraphicsUnit)int.MinValue)); 1087Assert.Throws<ArgumentNullException>(() => g.EndContainer(null)); 1135Assert.Throws<NullReferenceException>(() => g.Restore(null)); 1143Assert.Throws<ArgumentNullException>(() => g.FillRectangles(null, new Rectangle[1])); 1151Assert.Throws<ArgumentNullException>(() => g.FillRectangles(Brushes.Red, (Rectangle[])null)); 1159Assert.Throws<ArgumentException>(() => g.FillRectangles(Brushes.Red, Array.Empty<Rectangle>())); 1167Assert.Throws<ArgumentNullException>(() => g.FillRectangles(null, new RectangleF[1])); 1175Assert.Throws<ArgumentNullException>(() => g.FillRectangles(Brushes.Red, (RectangleF[])null)); 1183Assert.Throws<ArgumentException>(() => g.FillRectangles(Brushes.Red, Array.Empty<RectangleF>())); 1943Assert.Throws<ArgumentException>(() => MeasureCharacterRanges(text, text.Length, 1, useSpan)); 1952Assert.Throws<ArgumentException>(() => MeasureCharacterRanges(text, 0, text.Length + 1, useSpan)); 2147Assert.Throws<ArgumentException>(() => g.ReleaseHdcInternal(IntPtr.Zero)); 2157Assert.Throws<ArgumentException>(() => g.ReleaseHdcInternal(hdc)); 2177Assert.Throws<ArgumentException>(g.ReleaseHdc); 2187Assert.Throws<ArgumentException>(g.ReleaseHdc); 2337Assert.Throws<ArgumentNullException>(() => g.DrawIcon(null, new Rectangle(0, 0, 32, 32))); 2361Assert.Throws<ArgumentNullException>(() => g.DrawIcon(null, 4, 2)); 2378Assert.Throws<ArgumentNullException>(() => g.DrawIconUnstretched(null, new Rectangle(0, 0, 40, 20))); 2402Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, new RectangleF(0, 0, 0, 0))); 2421Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, new PointF(0, 0))); 2437Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, Array.Empty<PointF>())); 2445Assert.Throws<ArgumentNullException>(() => g.DrawImage(bmp, (PointF[])null)); 2453Assert.Throws<ArgumentException>(() => g.DrawImage(bmp, Array.Empty<PointF>())); 2472Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, new Rectangle(0, 0, 0, 0))); 2495Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, new Point(0, 0))); 2511Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, Array.Empty<Point>())); 2519Assert.Throws<ArgumentNullException>(() => g.DrawImage(bmp, (Point[])null)); 2527Assert.Throws<ArgumentException>(() => g.DrawImage(bmp, Array.Empty<Point>())); 2543Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, int.MaxValue, int.MinValue)); 2551Assert.Throws<OverflowException>(() => g.DrawImage(bmp, int.MaxValue, int.MinValue)); 2567Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, float.MaxValue, float.MinValue)); 2575Assert.Throws<OverflowException>(() => g.DrawImage(bmp, float.MaxValue, float.MinValue)); 2591Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, default(Rectangle), default, GraphicsUnit.Display)); 2605Assert.Throws<ArgumentException>(() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Display)); 2618Assert.Throws<ArgumentException>(() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.World)); 2628Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, pts, r, GraphicsUnit.Pixel)); 2642Assert.Throws<ArgumentNullException>(() => DrawImage_ImagePointRectangleGraphicsUnit(null)); 2686Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, pts, r, GraphicsUnit.Pixel)); 2700Assert.Throws<ArgumentNullException>(() => DrawImage_ImagePointFRectangleGraphicsUnit(null)); 2765Assert.Throws<ArgumentNullException>(() => g.DrawImageUnscaled(null, new Point(0, 0))); 2781Assert.Throws<ArgumentNullException>(() => g.DrawImageUnscaled(null, new Rectangle(0, 0, -1, -1))); 2797Assert.Throws<ArgumentNullException>(() => g.DrawImageUnscaled(null, 0, 0)); 2813Assert.Throws<ArgumentNullException>(() => g.DrawImageUnscaled(null, 0, 0, -1, -1)); 2829Assert.Throws<ArgumentNullException>(() => g.DrawImageUnscaledAndClipped(null, new Rectangle(0, 0, 0, 0))); 2857Assert.Throws<ArgumentNullException>(() => g.DrawPath(null, path)); 2865Assert.Throws<ArgumentNullException>(() => g.DrawPath(Pens.Black, null)); 2899Assert.Throws<ArgumentNullException>(() => g.FillPath(null, path)); 2907Assert.Throws<ArgumentNullException>(() => g.FillPath(Brushes.Black, null));
mono\System.Imaging\MetafileTest.cs (2)
266Assert.Throws<ArgumentNullException>(() => Metafile_StreamEmfType(null, EmfType.EmfOnly)); 280Assert.Throws<ArgumentException>(() => Metafile_StreamEmfType(ms, (EmfType)int.MinValue));
System\Drawing\BitmapTests.cs (4)
909Assert.Throws<InvalidOperationException>(() => bitmap.MakeTransparent(Color.Red)); 933Assert.Throws<InvalidOperationException>(() => bitmap.SetPixel(0, 0, Color.Red)); 1242Assert.Throws<ExternalException>(() => bitmap.UnlockBits(new BitmapData())); 1252Assert.Throws<ExternalException>(() => bitmap.UnlockBits(new BitmapData()));
System\Drawing\BufferedGraphicsContextTests.cs (2)
233Assert.Throws<InvalidOperationException>(context.Dispose); 246Assert.Throws<InvalidOperationException>(context.Dispose);
System\Drawing\Drawing2D\GraphicsPathTests.cs (4)
1066Assert.Throws<ArgumentNullException>(() => 1068Assert.Throws<ArgumentNullException>(() => 1070Assert.Throws<ArgumentNullException>(() => 1072Assert.Throws<ArgumentNullException>(() =>
System\Drawing\Drawing2D\MatrixTests.cs (2)
375Assert.Throws<InvalidOperationException>(() => matrix.Multiply(matrix)); 376Assert.Throws<InvalidOperationException>(() => matrix.Multiply(matrix, MatrixOrder.Prepend));
System\Drawing\FontTests.cs (3)
766Assert.Throws<ArgumentNullException>(() => font.ToLogFont(null)); 767Assert.Throws<ArgumentNullException>(() => font.ToLogFont(null, graphics)); 787Assert.Throws<ArgumentException>(() => font.ToLogFont(new LOGFONT(), graphics));
System\Drawing\Graphics_DrawBezierTests.cs (5)
92Assert.Throws<InvalidOperationException>(() => graphics.DrawBezier(pen, 1, 2, 3, 4, 5, 6, 7, 8)); 93Assert.Throws<InvalidOperationException>(() => graphics.DrawBezier(pen, Point.Empty, Point.Empty, Point.Empty, Point.Empty)); 94Assert.Throws<InvalidOperationException>(() => graphics.DrawBezier(pen, PointF.Empty, PointF.Empty, PointF.Empty, PointF.Empty)); 166Assert.Throws<InvalidOperationException>(() => graphics.DrawBeziers(pen, new Point[2])); 167Assert.Throws<InvalidOperationException>(() => graphics.DrawBeziers(pen, new PointF[2]));
System\Drawing\Graphics_DrawLineTests.cs (6)
72Assert.Throws<InvalidOperationException>(() => graphics.DrawLine(pen, Point.Empty, Point.Empty)); 73Assert.Throws<InvalidOperationException>(() => graphics.DrawLine(pen, 0, 0, 0, 0)); 74Assert.Throws<InvalidOperationException>(() => graphics.DrawLine(pen, PointF.Empty, PointF.Empty)); 75Assert.Throws<InvalidOperationException>(() => graphics.DrawLine(pen, 0f, 0f, 0f, 0f)); 149Assert.Throws<InvalidOperationException>(() => graphics.DrawLines(pen, new Point[2])); 150Assert.Throws<InvalidOperationException>(() => graphics.DrawLines(pen, new PointF[2]));
System\Drawing\GraphicsTests.Core.cs (2)
102Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangle(pen, new RectangleF(0f, 0f, 1f, 1f))); 178Assert.Throws<InvalidOperationException>(() => graphics.FillPie(brush, new RectangleF(0, 0, 1, 1), 0, 90));
System\Drawing\GraphicsTests.cs (54)
559Assert.Throws<InvalidOperationException>(graphics.Flush); 560Assert.Throws<InvalidOperationException>(() => graphics.Flush(FlushIntention.Sync)); 1166Assert.Throws<InvalidOperationException>(graphics.ResetTransform); 1270Assert.Throws<InvalidOperationException>(() => graphics.MultiplyTransform(matrix)); 1271Assert.Throws<InvalidOperationException>(() => graphics.MultiplyTransform(matrix, MatrixOrder.Append)); 1346Assert.Throws<InvalidOperationException>(() => graphics.TranslateTransform(0, 0)); 1347Assert.Throws<InvalidOperationException>(() => graphics.TranslateTransform(0, 0, MatrixOrder.Append)); 1427Assert.Throws<InvalidOperationException>(() => graphics.ScaleTransform(0, 0)); 1428Assert.Throws<InvalidOperationException>(() => graphics.ScaleTransform(0, 0, MatrixOrder.Append)); 1503Assert.Throws<InvalidOperationException>(() => graphics.RotateTransform(0)); 1504Assert.Throws<InvalidOperationException>(() => graphics.RotateTransform(0, MatrixOrder.Append)); 1660Assert.Throws<InvalidOperationException>(() => graphics.CopyFromScreen(0, 0, 0, 0, Size.Empty)); 1661Assert.Throws<InvalidOperationException>(() => graphics.CopyFromScreen(0, 0, 0, 0, Size.Empty, CopyPixelOperation.DestinationInvert)); 1662Assert.Throws<InvalidOperationException>(() => graphics.CopyFromScreen(Point.Empty, Point.Empty, Size.Empty)); 1663Assert.Throws<InvalidOperationException>(() => graphics.CopyFromScreen(Point.Empty, Point.Empty, Size.Empty, CopyPixelOperation.DestinationInvert)); 2013Assert.Throws<InvalidOperationException>(() => graphics.DrawArc(pen, new Rectangle(0, 0, 1, 1), 0, 90)); 2014Assert.Throws<InvalidOperationException>(() => graphics.DrawArc(pen, 0, 0, 1, 1, 0, 90)); 2015Assert.Throws<InvalidOperationException>(() => graphics.DrawArc(pen, new RectangleF(0, 0, 1, 1), 0, 90)); 2016Assert.Throws<InvalidOperationException>(() => graphics.DrawArc(pen, 0f, 0f, 1f, 1f, 0, 90)); 2070Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangle(pen, new Rectangle(0, 0, 1, 1))); 2071Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangle(pen, 0, 0, 1, 1)); 2072Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangle(pen, 0f, 0f, 1f, 1f)); 2143Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangles(pen, new Rectangle[2])); 2144Assert.Throws<InvalidOperationException>(() => graphics.DrawRectangles(pen, new RectangleF[2])); 2198Assert.Throws<InvalidOperationException>(() => graphics.DrawEllipse(pen, new Rectangle(0, 0, 1, 1))); 2199Assert.Throws<InvalidOperationException>(() => graphics.DrawEllipse(pen, 0, 0, 1, 1)); 2200Assert.Throws<InvalidOperationException>(() => graphics.DrawEllipse(pen, new RectangleF(0, 0, 1, 1))); 2201Assert.Throws<InvalidOperationException>(() => graphics.DrawEllipse(pen, 0f, 0f, 1f, 1f)); 2281Assert.Throws<InvalidOperationException>(() => graphics.DrawPie(pen, new Rectangle(0, 0, 1, 1), 0, 90)); 2282Assert.Throws<InvalidOperationException>(() => graphics.DrawPie(pen, 0, 0, 1, 1, 0, 90)); 2283Assert.Throws<InvalidOperationException>(() => graphics.DrawPie(pen, new RectangleF(0, 0, 1, 1), 0, 90)); 2284Assert.Throws<InvalidOperationException>(() => graphics.DrawPie(pen, 0f, 0f, 1f, 1f, 0, 90)); 2358Assert.Throws<InvalidOperationException>(() => graphics.DrawPolygon(pen, new Point[2])); 2359Assert.Throws<InvalidOperationException>(() => graphics.DrawPolygon(pen, new PointF[2])); 2431Assert.Throws<InvalidOperationException>(() => graphics.DrawPath(pen, graphicsPath)); 2539Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new Point[2])); 2540Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new PointF[2])); 2541Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new Point[2], 1)); 2542Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new PointF[2], 1)); 2543Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new PointF[2], 0, 2)); 2544Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new Point[2], 0, 2, 1)); 2545Assert.Throws<InvalidOperationException>(() => graphics.DrawCurve(pen, new PointF[2], 0, 2, 1)); 2631Assert.Throws<InvalidOperationException>(() => graphics.DrawClosedCurve(pen, new Point[3])); 2632Assert.Throws<InvalidOperationException>(() => graphics.DrawClosedCurve(pen, new Point[3], 1, FillMode.Winding)); 2633Assert.Throws<InvalidOperationException>(() => graphics.DrawClosedCurve(pen, new PointF[3])); 2634Assert.Throws<InvalidOperationException>(() => graphics.DrawClosedCurve(pen, new PointF[3], 1, FillMode.Winding)); 2710Assert.Throws<InvalidOperationException>(() => graphics.FillPie(brush, new Rectangle(0, 0, 1, 1), 0, 90)); 2711Assert.Throws<InvalidOperationException>(() => graphics.FillPie(brush, 0, 0, 1, 1, 0, 90)); 2712Assert.Throws<InvalidOperationException>(() => graphics.FillPie(brush, 0f, 0f, 1f, 1f, 0, 90)); 2760Assert.Throws<InvalidOperationException>(() => graphics.Clear(Color.Red)); 2867Assert.Throws<ArgumentNullException>(() => graphics.DrawCachedBitmap(null!, 0, 0)); 2878Assert.Throws<ArgumentException>(() => graphics.DrawCachedBitmap(cachedBitmap, 0, 0)); 2910Assert.Throws<InvalidOperationException>(() => graphics.DrawCachedBitmap(cachedBitmap, 0, 0)); 2935Assert.Throws<InvalidOperationException>(() => graphics2.DrawCachedBitmap(cachedBitmap, 0, 0));
System\Drawing\IconTests.cs (11)
453Assert.Throws<ArgumentNullException>(() => icon.Save(null)); 473Assert.Throws<ObjectDisposedException>(() => icon.Save(stream)); 492Assert.Throws<ObjectDisposedException>(() => icon.Save(stream)); 502Assert.Throws<ObjectDisposedException>(() => icon.Save(new MemoryStream())); 786Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0, 16); }); 787Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0); }); 793Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0, 16); }); 794Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0); }); 804Assert.Throws<ArgumentOutOfRangeException>(() => { Icon.ExtractIcon("Foo", 0, size); }); 810Assert.Throws<IOException>(() => 815Assert.Throws<IOException>(() =>
System\Drawing\ImageTests.cs (4)
150Assert.Throws<ExternalException>(() => bitmap.RemovePropertyItem(PropertyTagChrominanceTable)); 170Assert.Throws<ExternalException>(() => bitmap.RemovePropertyItem(PropertyTagChrominanceTable)); 180Assert.Throws<ExternalException>(() => bitmap.RemovePropertyItem(propid)); 190Assert.Throws<ExternalException>(() => bitmap.RemovePropertyItem(propid));
System\Drawing\Imaging\ImageAttributesTests.cs (10)
1082Assert.Throws<ArgumentNullException>(() => imageAttr.SetOutputChannelColorProfile(null)); 1083Assert.Throws<ArgumentNullException>(() => imageAttr.SetOutputChannelColorProfile(null, ColorAdjustType.Default)); 1090Assert.Throws<ArgumentException>(() => imageAttr.SetOutputChannelColorProfile(string.Empty)); 1091Assert.Throws<ArgumentException>(() => imageAttr.SetOutputChannelColorProfile(string.Empty, ColorAdjustType.Default)); 1098Assert.Throws<OutOfMemoryException>(() => imageAttr.SetOutputChannelColorProfile("invalidPath")); 1099Assert.Throws<OutOfMemoryException>(() => imageAttr.SetOutputChannelColorProfile("invalidPath", ColorAdjustType.Default)); 1107Assert.Throws<PathTooLongException>(() => imageAttr.SetOutputChannelColorProfile(fileNameTooLong)); 1108Assert.Throws<PathTooLongException>(() => imageAttr.SetOutputChannelColorProfile(fileNameTooLong, ColorAdjustType.Default)); 1228Assert.Throws<ArgumentNullException>(() => imageAttr.SetRemapTable(null, ColorAdjustType.Default)); 1315Assert.Throws<NullReferenceException>(() => imageAttr.GetAdjustedPalette(null, ColorAdjustType.Default));
System\Drawing\PenTests.cs (2)
797Assert.Throws<ArgumentNullException>(() => pen.MultiplyTransform(null)); 798Assert.Throws<ArgumentNullException>(() => pen.MultiplyTransform(null, MatrixOrder.Prepend));
System\Drawing\Printing\PreviewPrintControllerTests.cs (1)
111Assert.Throws<NullReferenceException>(() => controller.OnStartPrint(null, new PrintEventArgs()));
System\Drawing\Printing\PrintControllerTests.cs (1)
85Assert.Throws<NullReferenceException>(() => controller.OnStartPrint(null, new PrintEventArgs()));
System\Drawing\RegionTests.cs (5)
419Assert.Throws<InvalidOperationException>(() => region.Complement(region)); 826Assert.Throws<InvalidOperationException>(() => region.Exclude(region)); 1159Assert.Throws<InvalidOperationException>(() => region.Intersect(region)); 1722Assert.Throws<InvalidOperationException>(() => region.Union(region)); 2080Assert.Throws<InvalidOperationException>(() => region.Xor(region));
System\Drawing\StringFormatTests.cs (3)
163Assert.Throws<ArgumentNullException>(() => format.SetTabStops(0, null)); 218Assert.Throws<ArgumentNullException>(() => format.SetMeasurableCharacterRanges(null)); 225Assert.Throws<OverflowException>(() => format.SetMeasurableCharacterRanges(new CharacterRange[33]));
System\Drawing\Text\PrivateFontCollectionTests.cs (2)
107Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName")); 114Assert.Throws<FileNotFoundException>(
System.ServiceModel.Http.Tests (1)
ServiceModel\SecurityBindingElementTest.cs (1)
36Assert.Throws<PlatformNotSupportedException>(() =>
System.ServiceModel.NetTcp.Tests (2)
ServiceModel\MessageSecurityOverTcpTest.cs (2)
23Assert.Throws <PlatformNotSupportedException>(() => 35Assert.Throws<PlatformNotSupportedException>(() =>
System.ServiceModel.Primitives.Tests (28)
Channels\CommunicationObjectTest.cs (4)
316InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 343InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 368InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 399InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() =>
Channels\CustomBindingTest.cs (1)
56Assert.Throws<ArgumentException>(() =>
Channels\CustomChannelTest.cs (4)
245InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 299InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 623Assert.Throws<InvalidOperationException>(() => ((IClientChannel)channel).Open()); 676Assert.Throws<InvalidOperationException>(() => ((IClientChannel)channel).DisplayInitializationUI());
Description\OperationContractAttributeTest.cs (2)
30var exception = Assert.Throws<InvalidOperationException>(() => 43var exception = Assert.Throws<InvalidOperationException>(() =>
IdentityModel\SecurityTokenSerializerTest.cs (3)
66Assert.Throws<ArgumentNullException>(() => sts.WriteToken(null, null)); 67Assert.Throws<ArgumentNullException>(() => sts.WriteKeyIdentifier(null, null)); 68Assert.Throws<ArgumentNullException>(() => sts.WriteKeyIdentifierClause(null, null));
ServiceModel\DeliveryRequirementsTest.cs (3)
29Assert.Throws<InvalidOperationException>(() => factory.Open()); 59Assert.Throws<InvalidOperationException>(() => factory.Open()); 68Assert.Throws<InvalidOperationException>(() => factory.Open());
ServiceModel\DuplexChannelFactoryTest.cs (5)
28Assert.Throws<InvalidOperationException>(() => 46Assert.Throws<UriFormatException>(() => 58Assert.Throws<UriFormatException>(() => 103var exception = Assert.Throws<InvalidOperationException>(() => 133Assert.Throws<InvalidOperationException>(() =>
ServiceModel\SynchronizedCollection.cs (6)
96Assert.Throws<ArgumentOutOfRangeException>(() => 101Assert.Throws<ArgumentOutOfRangeException>(() => 106Assert.Throws<ArgumentOutOfRangeException>(() => 111Assert.Throws<ArgumentOutOfRangeException>(() => 118Assert.Throws<ArgumentOutOfRangeException>(() => 123Assert.Throws<ArgumentOutOfRangeException>(() =>
System.Windows.Forms.Design.Tests (76)
System\ComponentModel\Design\ByteViewerTests.cs (2)
395Assert.Throws<NullReferenceException>(() => control.OnLayout(null)); 587Assert.Throws<NullReferenceException>(() => control.OnPaint(null));
System\ComponentModel\Design\ComponentDesignerTests.cs (4)
2260Assert.Throws<NotImplementedException>(() => designer.InitializeExistingComponent(defaultValues)); 2375Assert.Throws<InvalidOperationException>(() => designer.PreFilterProperties(properties)); 2478Assert.Throws<ArrayTypeMismatchException>(() => designer.PostFilterEvents(new Dictionary<object, object> { { "key", new object() } })); 2906Assert.Throws<ArrayTypeMismatchException>(() => filter.PostFilterEvents(new Dictionary<object, object> { { "key", new object() } }));
System\ComponentModel\Design\DesignerActionMethodItemTests.cs (3)
208Assert.Throws<InvalidOperationException>(item.Invoke); 219Assert.Throws<InvalidOperationException>(item.Invoke); 235Assert.Throws<TargetParameterCountException>(item.Invoke);
System\ComponentModel\Design\DesignerHostTests.cs (25)
897Assert.Throws<Exception>(() => host.Container.Add(newComponent)); 1655Assert.Throws<NotImplementedException>(() => host.Container.Add(component)); 1656Assert.Throws<NotImplementedException>(() => host.Container.Add(component, "name")); 1668Assert.Throws<InvalidOperationException>(() => host.Container.Add(component)); 1669Assert.Throws<InvalidOperationException>(() => host.Container.Add(new RootDesignerComponent(), host.RootComponentClassName)); 1678Assert.Throws<InvalidOperationException>(() => host.Container.Add(component)); 1679Assert.Throws<InvalidOperationException>(() => host.Container.Add(component, "name")); 1688Assert.Throws<DivideByZeroException>(() => host.Container.Add(component)); 1692Assert.Throws<DivideByZeroException>(() => host.Container.Add(component, "name")); 1786Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), new object())); 1787Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), new object(), true)); 1788Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), new object(), false)); 1789Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), callback)); 1790Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), callback, true)); 1791Assert.Throws<ObjectDisposedException>(() => host.AddService(typeof(object), callback, false)); 1800Assert.Throws<InvalidOperationException>(disposable.Dispose); 1812Assert.Throws<InvalidOperationException>(surface.Dispose); 1827Assert.Throws<InvalidOperationException>(surface.Dispose); 1840Assert.Throws<InvalidOperationException>(surface.Dispose); 1852Assert.Throws<InvalidOperationException>(surface.Dispose); 2069Assert.Throws<InvalidOperationException>(transaction1.Cancel); 2182Assert.Throws<InvalidOperationException>(transaction1.Commit); 2916Assert.Throws<ObjectDisposedException>(() => host.RemoveService(typeof(object))); 2917Assert.Throws<ObjectDisposedException>(() => host.RemoveService(typeof(object), true)); 2918Assert.Throws<ObjectDisposedException>(() => host.RemoveService(typeof(object), false));
System\ComponentModel\Design\DesignSurfaceTests.cs (9)
291Assert.Throws<InvalidOperationException>(() => container.RemoveService(serviceType)); 960Assert.Throws<InvalidOperationException>(() => surface.BeginLoad(typeof(RootDesignerComponent))); 961Assert.Throws<InvalidOperationException>(() => surface.BeginLoad(otherMockLoader.Object)); 970Assert.Throws<ObjectDisposedException>(() => surface.BeginLoad(typeof(RootDesignerComponent))); 971Assert.Throws<ObjectDisposedException>(() => surface.BeginLoad(mockLoader.Object)); 1193Assert.Throws<InvalidOperationException>(surface.Dispose); 1214Assert.Throws<InvalidOperationException>(surface.Dispose); 1295Assert.Throws<InvalidOperationException>(() => surface.Dispose(true)); 1333Assert.Throws<InvalidOperationException>(() => surface.Dispose(true));
System\ComponentModel\Design\ExceptionCollectionTests.cs (3)
54Assert.Throws<SerializationException>(() => formatter.Serialize(stream, collection)); 58Assert.Throws<NotSupportedException>(() => formatter.Serialize(stream, collection)); 66Assert.Throws<PlatformNotSupportedException>(() => collection.GetObjectData(null, default));
System\ComponentModel\Design\Serialization\CodeDomComponentSerializationServiceTests.cs (11)
623Assert.Throws<DivideByZeroException>(store.Close); 693Assert.Throws<SerializationException>(() => formatter.Serialize(stream, store)); 697Assert.Throws<NotSupportedException>(() => formatter.Serialize(stream, store)); 904Assert.Throws<InvalidOperationException>(() => service.Serialize(mockStore.Object, new object())); 913Assert.Throws<InvalidOperationException>(() => service.Serialize(store, new object())); 1112Assert.Throws<InvalidOperationException>(() => service.SerializeAbsolute(mockStore.Object, new object())); 1121Assert.Throws<InvalidOperationException>(() => service.SerializeAbsolute(store, new object())); 1390Assert.Throws<InvalidOperationException>(() => service.SerializeMember(mockStore.Object, new DataClass(), member)); 1400Assert.Throws<InvalidOperationException>(() => service.SerializeMember(store, new DataClass(), member)); 1669Assert.Throws<InvalidOperationException>(() => service.SerializeMemberAbsolute(mockStore.Object, new DataClass(), member)); 1679Assert.Throws<InvalidOperationException>(() => service.SerializeMemberAbsolute(store, new DataClass(), member));
System\ComponentModel\Design\Serialization\CodeDomSerializerExceptionTests.cs (3)
97Assert.Throws<SerializationException>(() => formatter.Serialize(stream, exception)); 101Assert.Throws<NotSupportedException>(() => formatter.Serialize(stream, exception)); 109Assert.Throws<PlatformNotSupportedException>(() => exception.GetObjectData(null, default));
System\ComponentModel\Design\Serialization\DesignerSerializationManagerTests.cs (4)
387Assert.Throws<InvalidOperationException>(() => iManager.ResolveName += handler); 399Assert.Throws<InvalidOperationException>(() => iManager.SerializationComplete += handler); 1907Assert.Throws<InvalidOperationException>(() => iManager.ReportError(null)); 1979Assert.Throws<InvalidOperationException>(() => iManager.SetName(null, null));
System\ComponentModel\Design\SiteNestedContainerTests.cs (8)
570Assert.Throws<NotImplementedException>(() => container.Add(component)); 571Assert.Throws<NotImplementedException>(() => container.Add(component, "name")); 585Assert.Throws<InvalidOperationException>(() => container.Add(component)); 586Assert.Throws<InvalidOperationException>(() => container.Add(new RootDesignerComponent(), host.RootComponentClassName)); 596Assert.Throws<InvalidOperationException>(() => container.Add(component)); 597Assert.Throws<InvalidOperationException>(() => container.Add(component, "name")); 607Assert.Throws<DivideByZeroException>(() => container.Add(component)); 611Assert.Throws<DivideByZeroException>(() => container.Add(component, "name"));
System\Drawing\Design\ToolboxItemTests.cs (2)
976Assert.Throws<InvalidOperationException>(item.CheckUnlocked); 1444Assert.Throws<InvalidOperationException>(() => item.Initialize(type));
System\Windows\Forms\Design\EventHandlerServiceTests.cs (2)
92Assert.Throws<ArgumentNullException>(() => service.PopHandler(null)); 150Assert.Throws<ArgumentNullException>(() => service.PushHandler(null));
System.Windows.Forms.Primitives.TestUtilities (7)
Extensions\AssertExtensions.cs (7)
30Assert.Equal(expectedMessage, Assert.Throws<T>(action).Message); 36Assert.Contains(expectedMessageContent, Assert.Throws<T>(action).Message); 42T exception = Assert.Throws<T>(action); 79T exception = Assert.Throws<T>(action); 89T exception = Assert.Throws<T>(action); 102Assert.Throws<TException>(() => 248Assert.Throws<T>(action);
System.Windows.Forms.Tests (393)
CheckedListBoxTests.cs (2)
360ArgumentOutOfRangeException ex = Assert.Throws<ArgumentOutOfRangeException>(() => box.SetItemCheckState(index, CheckState.Checked)); 455Assert.Throws<NullReferenceException>(() => control.OnDrawItem(null));
DataStreamFromComStreamTests.cs (1)
17Assert.Throws<IOException>(() => dataStream.Write(new byte[bufferSize], index, count));
ExceptionHandlingTests.cs (1)
19Assert.Throws<InvalidOperationException>(() => action());
System\Resources\ResXResourceReaderTests.cs (4)
21Assert.Throws<PlatformNotSupportedException>(() => 37Assert.Throws<PlatformNotSupportedException>(resourceWriter.Generate); 192ArgumentException exception = Assert.Throws<ArgumentException>(() => { IDictionaryEnumerator enumerator = resXReader.GetEnumerator(); }); 214ArgumentException exception = Assert.Throws<ArgumentException>(() =>
System\Resources\ResXResourceWriterTests.cs (1)
277Assert.Throws<ArgumentNullException>(() =>
System\Windows\Forms\AccessibleObjects\DataGridViewButtonCellAccessibleObjectTests.cs (2)
56Assert.Throws<InvalidOperationException>(() 67Assert.Throws<InvalidOperationException>(accessibleObject.DoDefaultAction);
System\Windows\Forms\AccessibleObjects\DataGridViewCellAccessibleObjectTests.cs (2)
372Assert.Throws<InvalidOperationException>(accessibleObject.DoDefaultAction); 461Assert.Throws<InvalidOperationException>(() => accessibleObject.Select(AccessibleSelection.None));
System\Windows\Forms\AccessibleObjects\DataGridViewCheckBoxCellAccessibleObjectTests.cs (2)
193Assert.Throws<InvalidOperationException>(() 203Assert.Throws<InvalidOperationException>(cell.AccessibilityObject.DoDefaultAction);
System\Windows\Forms\AccessibleObjects\DataGridViewImageCellAccessibleObjectTests.cs (1)
91Assert.Throws<InvalidOperationException>(() =>
System\Windows\Forms\AccessibleObjects\DataGridViewLinkCellAccessibleObjectTests.cs (2)
56Assert.Throws<InvalidOperationException>(() => 66Assert.Throws<InvalidOperationException>(cell.AccessibilityObject.DoDefaultAction);
System\Windows\Forms\AccessibleObjects\DataGridViewRowAccessibleObjectTests.cs (1)
385Assert.Throws<InvalidOperationException>(() => accessibleObject.Select(AccessibleSelection.None));
System\Windows\Forms\ApplicationTests.cs (1)
251Assert.Throws<InvalidOperationException>(() => Application.SetDefaultFont(SystemFonts.CaptionFont));
System\Windows\Forms\AxHost.AxPropertyDescriptorTests.cs (6)
1058Assert.Throws<TargetException>(() => property.SetValue(new object(), "Value")); 1067Assert.Throws<TargetException>(() => property.SetValue(new object(), "Value")); 1110Assert.Throws<ArgumentException>(() => property.SetValue(control, new object())); 1119Assert.Throws<ArgumentException>(() => property.SetValue(control, new object())); 1158Assert.Throws<ArgumentException>(() => property.SetValue(control, new object())); 1167Assert.Throws<ArgumentException>(() => property.SetValue(control, new object()));
System\Windows\Forms\AxHostTests.cs (39)
931Assert.Throws<NotSupportedException>(() => control.BackColorChanged += handler); 940Assert.Throws<NotSupportedException>(() => control.BackgroundImageChanged += handler); 949Assert.Throws<NotSupportedException>(() => control.BackgroundImageLayoutChanged += handler); 958Assert.Throws<NotSupportedException>(() => control.BindingContextChanged += handler); 967Assert.Throws<NotSupportedException>(() => control.ChangeUICues += handler); 976Assert.Throws<NotSupportedException>(() => control.Click += handler); 985Assert.Throws<NotSupportedException>(() => control.CursorChanged += handler); 994Assert.Throws<NotSupportedException>(() => control.DoubleClick += handler); 1003Assert.Throws<NotSupportedException>(() => control.DragDrop += handler); 1012Assert.Throws<NotSupportedException>(() => control.DragEnter += handler); 1021Assert.Throws<NotSupportedException>(() => control.DragLeave += handler); 1030Assert.Throws<NotSupportedException>(() => control.DragOver += handler); 1039Assert.Throws<NotSupportedException>(() => control.EnabledChanged += handler); 1048Assert.Throws<NotSupportedException>(() => control.FontChanged += handler); 1057Assert.Throws<NotSupportedException>(() => control.ForeColorChanged += handler); 1066Assert.Throws<NotSupportedException>(() => control.GiveFeedback += handler); 1075Assert.Throws<NotSupportedException>(() => control.HelpRequested += handler); 1084Assert.Throws<NotSupportedException>(() => control.ImeModeChanged += handler); 1093Assert.Throws<NotSupportedException>(() => control.KeyDown += handler); 1102Assert.Throws<NotSupportedException>(() => control.KeyPress += handler); 1111Assert.Throws<NotSupportedException>(() => control.KeyUp += handler); 1120Assert.Throws<NotSupportedException>(() => control.Layout += handler); 1129Assert.Throws<NotSupportedException>(() => control.MouseClick += handler); 1138Assert.Throws<NotSupportedException>(() => control.MouseDoubleClick += handler); 1147Assert.Throws<NotSupportedException>(() => control.MouseDown += handler); 1156Assert.Throws<NotSupportedException>(() => control.MouseEnter += handler); 1165Assert.Throws<NotSupportedException>(() => control.MouseHover += handler); 1174Assert.Throws<NotSupportedException>(() => control.MouseLeave += handler); 1183Assert.Throws<NotSupportedException>(() => control.MouseMove += handler); 1192Assert.Throws<NotSupportedException>(() => control.MouseUp += handler); 1201Assert.Throws<NotSupportedException>(() => control.MouseWheel += handler); 1210Assert.Throws<NotSupportedException>(() => control.Paint += handler); 1219Assert.Throws<NotSupportedException>(() => control.QueryAccessibilityHelp += handler); 1228Assert.Throws<NotSupportedException>(() => control.QueryContinueDrag += handler); 1237Assert.Throws<NotSupportedException>(() => control.RightToLeftChanged += handler); 1246Assert.Throws<NotSupportedException>(() => control.StyleChanged += handler); 1255Assert.Throws<NotSupportedException>(() => control.TextChanged += handler); 1335Assert.Throws<NullReferenceException>(() => control.DoVerb(verb)); 1383Assert.Throws<COMException>(control.CreateControl);
System\Windows\Forms\BaseCollectionTests.cs (2)
41Assert.Throws<NullReferenceException>(() => collection.CopyTo(Array.Empty<object>(), 0)); 57Assert.Throws<NullReferenceException>(() => collection.CopyTo(Array.Empty<object>(), 0));
System\Windows\Forms\BindingContextTests.cs (1)
744Assert.Throws<NotImplementedException>(() => context.CollectionChanged += handler);
System\Windows\Forms\ButtonBaseTests.cs (4)
5738Assert.Throws<NullReferenceException>(() => control.OnKeyDown(null)); 6018Assert.Throws<NullReferenceException>(() => control.OnKeyUp(null)); 6205Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 6820Assert.Throws<NullReferenceException>(() => control.OnMouseMove(null));
System\Windows\Forms\ButtonTests.cs (2)
2353Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 2865Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null));
System\Windows\Forms\Combobox.ObjectCollectionTests.cs (5)
396Assert.Throws<ArgumentException>(() => comboBoxObjectCollection.AddRange(new string[] { "a", "b" })); 464Assert.Throws<ArgumentException>(comboBoxObjectCollection.Clear); 826Assert.Throws<ArgumentException>(() => comboBoxObjectCollection.Insert(3, 1)); 927Assert.Throws<ArgumentException>(() => comboBoxObjectCollection.RemoveAt(0)); 1072Assert.Throws<ArgumentException>(() => comboBoxObjectCollection.Remove("a"));
System\Windows\Forms\ControlPaintTests.cs (18)
664Assert.Throws<ArgumentOutOfRangeException>(() => ControlPaint.DrawBorder(graphics, bounds, leftColor, leftWidth, leftStyle, topColor, topWidth, topStyle, rightColor, rightWidth, rightStyle, bottomColor, bottomWidth, bottomStyle)); 865Assert.Throws<ArgumentException>(() => ControlPaint.DrawButton(graphics, new Rectangle(0, 0, width, height), state)); 866Assert.Throws<ArgumentException>(() => ControlPaint.DrawButton(graphics, 0, 0, width, height, state)); 948Assert.Throws<ArgumentException>(() => ControlPaint.DrawCaptionButton(graphics, new Rectangle(0, 0, width, height), CaptionButton.Close, state)); 949Assert.Throws<ArgumentException>(() => ControlPaint.DrawCaptionButton(graphics, 0, 0, width, height, CaptionButton.Close, state)); 1029Assert.Throws<ArgumentException>(() => ControlPaint.DrawCheckBox(graphics, new Rectangle(0, 0, width, height), state)); 1030Assert.Throws<ArgumentException>(() => ControlPaint.DrawCheckBox(graphics, 0, 0, width, height, state)); 1109Assert.Throws<ArgumentException>(() => ControlPaint.DrawComboButton(graphics, new Rectangle(0, 0, width, height), state)); 1110Assert.Throws<ArgumentException>(() => ControlPaint.DrawComboButton(graphics, 0, 0, width, height, state)); 1349Assert.Throws<NullReferenceException>(() => ControlPaint.DrawImageDisabled(graphics, null, 0, 0, Color.Red)); 1488Assert.Throws<ArgumentException>(() => ControlPaint.DrawMenuGlyph(graphics, new Rectangle(0, 0, width, height), glyph)); 1489Assert.Throws<ArgumentException>(() => ControlPaint.DrawMenuGlyph(graphics, 0, 0, width, height, glyph)); 1570Assert.Throws<ArgumentException>(() => ControlPaint.DrawMixedCheckBox(graphics, new Rectangle(0, 0, width, height), state)); 1571Assert.Throws<ArgumentException>(() => ControlPaint.DrawMixedCheckBox(graphics, 0, 0, width, height, state)); 1650Assert.Throws<ArgumentException>(() => ControlPaint.DrawRadioButton(graphics, new Rectangle(0, 0, width, height), state)); 1651Assert.Throws<ArgumentException>(() => ControlPaint.DrawRadioButton(graphics, 0, 0, width, height, state)); 1788Assert.Throws<ArgumentException>(() => ControlPaint.DrawScrollButton(graphics, new Rectangle(0, 0, width, height), ScrollButton.Up, state)); 1789Assert.Throws<ArgumentException>(() => ControlPaint.DrawScrollButton(graphics, 0, 0, width, height, ScrollButton.Up, state));
System\Windows\Forms\ControlTests.ControlCollection.cs (8)
81Assert.Throws<ArgumentException>(() => collection.Add(control2)); 408Assert.Throws<ArgumentException>(() => collection.Add(control)); 1115Assert.Throws<ArgumentException>(() => collection.Add(control)); 1134Assert.Throws<ArgumentException>(() => collection.Add(control)); 1158Assert.Throws<ArgumentException>(() => collection.Add(control)); 1171Assert.Throws<ArgumentException>(() => collection.Add(owner)); 1183Assert.Throws<ArgumentException>(() => collection.Add(parent)); 1199Assert.Throws<ArgumentException>(() => collection.Add(grandparent));
System\Windows\Forms\ControlTests.Handlers.cs (4)
2987Assert.Throws<NullReferenceException>(() => control.OnInvalidated(null)); 4170Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null)); 4658Assert.Throws<DivideByZeroException>(() => control.OnPrint(eventArgs)); 4726Assert.Throws<DivideByZeroException>(() => control.OnPrint(eventArgs));
System\Windows\Forms\ControlTests.Methods.cs (20)
596Assert.Throws<Win32Exception>(control.CreateControl); 604Assert.Throws<ObjectDisposedException>(control.CreateControl); 756Assert.Throws<Win32Exception>(control.CreateHandle); 764Assert.Throws<ObjectDisposedException>(control.CreateHandle); 772Assert.Throws<InvalidOperationException>(control.CreateHandle); 1899Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(x, y, width, height))); 1913Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(1, 2, 3, 4))); 1927Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(1, 2, 3, 4))); 2946Assert.Throws<NullReferenceException>(control.InitLayout); 3794Assert.Throws<DivideByZeroException>(() => control.Invoke(method)); 3822Assert.Throws<DivideByZeroException>(() => control.Invoke(method)); 3837DivideByZeroException exception = Assert.Throws<DivideByZeroException>(() => control.Invoke(() => FaultingMethod())); 3871DivideByZeroException exception = Assert.Throws<DivideByZeroException>(() => 3940DivideByZeroException exception = Assert.Throws<DivideByZeroException>(() => 4132Assert.Throws<InvalidOperationException>(() => control.Invoke(method)); 4265Assert.Throws<NullReferenceException>(() => control.InvokePaint(null, eventArgs)); 4321Assert.Throws<NullReferenceException>(() => control.InvokePaintBackground(null, eventArgs)); 4329Assert.Throws<ArgumentNullException>(() => control.InvokePaintBackground(otherControl, null)); 5251Assert.Throws<NullReferenceException>(control.PerformLayout); 5252Assert.Throws<NullReferenceException>(() => control.PerformLayout(new Control(), "AffectedProperty"));
System\Windows\Forms\ControlTests.Properties.cs (4)
9904Assert.Throws<ArgumentException>(oldValue.MakeEmpty); 9910Assert.Throws<ArgumentException>(oldValue.MakeEmpty); 9963Assert.Throws<ArgumentException>(oldValue.MakeEmpty); 9972Assert.Throws<ArgumentException>(oldValue.MakeEmpty);
System\Windows\Forms\CursorTests.cs (2)
408Assert.Throws<ArgumentException>(() => cursor.Draw(graphics, new Rectangle(Point.Empty, cursor.Size))); 445Assert.Throws<ArgumentException>(() => cursor.DrawStretched(graphics, new Rectangle(Point.Empty, cursor.Size)));
System\Windows\Forms\DataGridViewCellPaintingEventArgsTests.cs (6)
109Assert.Throws<InvalidOperationException>(() => e.Paint(new Rectangle(1, 2, 3, 4), DataGridViewPaintParts.None)); 122Assert.Throws<InvalidOperationException>(() => e.Paint(new Rectangle(1, 2, 3, 4), DataGridViewPaintParts.None)); 159Assert.Throws<InvalidOperationException>(() => e.PaintBackground(new Rectangle(1, 2, 3, 4), true)); 172Assert.Throws<InvalidOperationException>(() => e.PaintBackground(new Rectangle(1, 2, 3, 4), true)); 209Assert.Throws<InvalidOperationException>(() => e.PaintContent(new Rectangle(1, 2, 3, 4))); 222Assert.Throws<InvalidOperationException>(() => e.PaintContent(new Rectangle(1, 2, 3, 4)));
System\Windows\Forms\DataGridViewCellTests.cs (4)
3467Assert.Throws<InvalidOperationException>(cell.DetachEditingControl); 3481Assert.Throws<InvalidOperationException>(cell.DetachEditingControl); 5210Assert.Throws<InvalidOperationException>(() => cell.InitializeEditingControl(-1, null, null)); 6229Assert.Throws<InvalidOperationException>(() => cell.PositionEditingControl(true, true, new Rectangle(1, 2, 3, 4), new Rectangle(1, 2, 3, 4), new DataGridViewCellStyle(), true, true, true, true));
System\Windows\Forms\DataGridViewColumnCollectionTests.cs (1)
423Assert.Throws<InvalidOperationException>(iSupportInitialize.EndInit);
System\Windows\Forms\DataGridViewElementTests.cs (5)
92Assert.Throws<NullReferenceException>(() => element.RaiseCellClick(null)); 144Assert.Throws<NullReferenceException>(() => element.RaiseCellContentClick(null)); 196Assert.Throws<NullReferenceException>(() => element.RaiseCellContentDoubleClick(null)); 248Assert.Throws<NullReferenceException>(() => element.RaiseCellValueChanged(null)); 320Assert.Throws<NullReferenceException>(() => element.RaiseDataError(null));
System\Windows\Forms\DataGridViewHeaderCellTests.cs (5)
4227Assert.Throws<NullReferenceException>(() => cell.OnMouseDown(null)); 4296Assert.Throws<ArgumentOutOfRangeException>(() => cell.OnMouseEnter(rowIndex)); 4364Assert.Throws<ArgumentOutOfRangeException>(() => cell.OnMouseLeave(rowIndex)); 4510Assert.Throws<ArgumentOutOfRangeException>(() => cell.OnMouseUp(e)); 4610Assert.Throws<NullReferenceException>(() => cell.OnMouseUp(null));
System\Windows\Forms\DataGridViewRowPostPaintEventArgsTests.cs (6)
103Assert.Throws<InvalidOperationException>(() => e.DrawFocus(new Rectangle(1, 2, 3, 4), true)); 127Assert.Throws<InvalidOperationException>(() => e.PaintCells(new Rectangle(1, 2, 3, 4), DataGridViewPaintParts.None)); 151Assert.Throws<InvalidOperationException>(() => e.PaintCellsBackground(new Rectangle(1, 2, 3, 4), true)); 175Assert.Throws<InvalidOperationException>(() => e.PaintCellsContent(new Rectangle(1, 2, 3, 4))); 212Assert.Throws<InvalidOperationException>(() => e.PaintHeader(DataGridViewPaintParts.None)); 213Assert.Throws<InvalidOperationException>(() => e.PaintHeader(true));
System\Windows\Forms\DataGridViewRowPrePaintEventArgsTests.cs (6)
130Assert.Throws<InvalidOperationException>(() => e.DrawFocus(new Rectangle(1, 2, 3, 4), true)); 154Assert.Throws<InvalidOperationException>(() => e.PaintCells(new Rectangle(1, 2, 3, 4), DataGridViewPaintParts.None)); 178Assert.Throws<InvalidOperationException>(() => e.PaintCellsBackground(new Rectangle(1, 2, 3, 4), true)); 202Assert.Throws<InvalidOperationException>(() => e.PaintCellsContent(new Rectangle(1, 2, 3, 4))); 239Assert.Throws<InvalidOperationException>(() => e.PaintHeader(DataGridViewPaintParts.None)); 240Assert.Throws<InvalidOperationException>(() => e.PaintHeader(true));
System\Windows\Forms\DataGridViewRowTests.cs (10)
4125Assert.Throws<InvalidOperationException>(() => row.CreateCells(newControl)); 4126Assert.Throws<InvalidOperationException>(() => row.CreateCells(newControl, Array.Empty<object>())); 4136Assert.Throws<InvalidOperationException>(() => row.CreateCells(control)); 4137Assert.Throws<InvalidOperationException>(() => row.CreateCells(control, Array.Empty<object>())); 4215Assert.Throws<InvalidOperationException>(() => row.DrawFocus(graphics, new Rectangle(1, 2, 3, 4), new Rectangle(1, 2, 3, 4), -1, DataGridViewElementStates.None, new DataGridViewCellStyle(), true)); 4990Assert.Throws<InvalidOperationException>(() => row.Paint(null, Rectangle.Empty, Rectangle.Empty, -1, DataGridViewElementStates.None, true, true)); 5299Assert.Throws<InvalidOperationException>(() => row.PaintCells(null, Rectangle.Empty, Rectangle.Empty, -1, DataGridViewElementStates.None, true, true, DataGridViewPaintParts.All)); 5337Assert.Throws<ArgumentException>(() => row.PaintCells(graphics, Rectangle.Empty, Rectangle.Empty, -1, DataGridViewElementStates.None, true, true, paintParts)); 5623Assert.Throws<InvalidOperationException>(() => row.PaintHeader(null, Rectangle.Empty, Rectangle.Empty, -1, DataGridViewElementStates.None, true, true, DataGridViewPaintParts.All)); 5657Assert.Throws<InvalidOperationException>(() => row.PaintHeader(graphics, new Rectangle(1, 2, 100, 100), new Rectangle(1, 2, 100, 100), -1, DataGridViewElementStates.None, true, true, DataGridViewPaintParts.All));
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (6)
94Assert.Throws<NotSupportedException>(collection.Clear); 177Assert.Throws<NotSupportedException>(() => collection.Insert(index, dataGridViewCell)); 306Assert.Throws<NotSupportedException>(iList.Clear); 488Assert.Throws<NotSupportedException>(() => iList.Insert(index, value)); 505Assert.Throws<NotSupportedException>(() => iList.Remove(value)); 517Assert.Throws<NotSupportedException>(() => iList.RemoveAt(index));
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (6)
106Assert.Throws<NotSupportedException>(collection.Clear); 197Assert.Throws<NotSupportedException>(() => collection.Insert(index, dataGridViewColumn)); 338Assert.Throws<NotSupportedException>(iList.Clear); 536Assert.Throws<NotSupportedException>(() => iList.Insert(index, value)); 553Assert.Throws<NotSupportedException>(() => iList.Remove(value)); 565Assert.Throws<NotSupportedException>(() => iList.RemoveAt(index));
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (6)
91Assert.Throws<NotSupportedException>(collection.Clear); 172Assert.Throws<NotSupportedException>(() => collection.Insert(index, dataGridRow)); 298Assert.Throws<NotSupportedException>(iList.Clear); 476Assert.Throws<NotSupportedException>(() => iList.Insert(index, value)); 493Assert.Throws<NotSupportedException>(() => iList.Remove(value)); 505Assert.Throws<NotSupportedException>(() => iList.RemoveAt(index));
System\Windows\Forms\DataGridViewTests.cs (2)
2313Assert.Throws<NullReferenceException>(() => control.OnColumnHeadersHeightSizeModeChanged(null)); 2794Assert.Throws<NullReferenceException>(() => control.OnRowHeadersWidthSizeModeChanged(null));
System\Windows\Forms\DataGridViewTextBoxEditingControlTests.cs (1)
1431Assert.Throws<InvalidOperationException>(() => control.OnTextChanged(eventArgs));
System\Windows\Forms\ErrorProviderTests.cs (1)
840Assert.Throws<ArgumentException>(() => provider.BindToDataAndErrors(newDataSource, "NoSuchValue"));
System\Windows\Forms\FlowLayoutSettingsTests.cs (1)
249Assert.Throws<NotSupportedException>(() => settings.SetFlowBreak(new object(), value));
System\Windows\Forms\GroupBoxTests.cs (2)
1944Assert.Throws<ArgumentNullException>(() => control.OnPaint(null)); 1956Assert.Throws<NullReferenceException>(() => control.OnPaint(null));
System\Windows\Forms\HtmlDocumentTests.cs (2)
1512COMException ex = Assert.Throws<COMException>(() => document.AttachEventHandler(string.Empty, handler)); 1684Assert.Throws<COMException>(() => document.ExecCommand(command, showUI, value));
System\Windows\Forms\HtmlElementTests.cs (3)
1707COMException ex = Assert.Throws<COMException>(() => element.AttachEventHandler(string.Empty, handler)); 2472Assert.Throws<ArgumentException>(() => element.SetAttribute(null, "value")); 2487COMException ex = Assert.Throws<COMException>(() => element.SetAttribute(string.Empty, "value"));
System\Windows\Forms\ImageList.ImageCollectionTests.cs (9)
795Assert.Throws<InvalidOperationException>(() => collection.Add("Key", (Image)null)); 797Assert.Throws<InvalidOperationException>(() => collection.Add("Key", (Icon)null)); 807Assert.Throws<ArgumentException>(() => collection.Add(value)); 809Assert.Throws<ArgumentException>(() => collection.Add("Key", value)); 1297Assert.Throws<NotSupportedException>(() => collection.Remove(image)); 1589Assert.Throws<IndexOutOfRangeException>(() => collection.SetKeyName(index, "name")); 1601Assert.Throws<IndexOutOfRangeException>(() => collection.SetKeyName(index, "name")); 1807Assert.Throws<NotSupportedException>(() => collection.Insert(index, value)); 1822Assert.Throws<NotSupportedException>(() => collection.Remove(value));
System\Windows\Forms\ImageListTests.cs (3)
1024Assert.Throws<NullReferenceException>(() => list.Draw(null, Point.Empty, 0)); 1025Assert.Throws<NullReferenceException>(() => list.Draw(null, 0, 0, 0)); 1026Assert.Throws<NullReferenceException>(() => list.Draw(null, 0, 0, 10, 10, 0));
System\Windows\Forms\Layout\FlowLayoutTests.cs (1)
24Assert.Throws<NotSupportedException>(() => engine.InitLayout("child", BoundsSpecified.All));
System\Windows\Forms\Layout\LayoutEngineTests.cs (1)
21Assert.Throws<NotSupportedException>(() => engine.InitLayout("child", BoundsSpecified.All));
System\Windows\Forms\Layout\TableLayoutSettingsTests.cs (5)
664Assert.Throws<NotSupportedException>(() => settings.SetCellPosition("control", default)); 888Assert.Throws<NotSupportedException>(() => settings.SetColumn("control", 1)); 1120Assert.Throws<NotSupportedException>(() => settings.SetColumnSpan("control", 1)); 1364Assert.Throws<NotSupportedException>(() => settings.SetRow("control", 1)); 1595Assert.Throws<NotSupportedException>(() => settings.SetRowSpan("control", 1));
System\Windows\Forms\ListBox.IntegerCollectionTests.cs (1)
2560Assert.Throws<ArgumentException>(() => collection.Remove(item));
System\Windows\Forms\ListBox.ObjectCollectionTests.cs (19)
3626Assert.Throws<InvalidOperationException>(() => collection.AddRange(collection)); 3639Assert.Throws<InvalidOperationException>(() => collection.AddRange(collection)); 3670Assert.Throws<ArgumentException>(() => collection.AddRange(Array.Empty<object>())); 3671Assert.Throws<ArgumentException>(() => collection.AddRange(otherCollection)); 3695Assert.Throws<OutOfMemoryException>(() => collection.AddRange(otherCollection)); 5033Assert.Throws<ArgumentException>(() => collection.Insert(0, 1)); 5050Assert.Throws<OutOfMemoryException>(() => collection.Insert(0, 1)); 5985Assert.Throws<ArgumentException>(() => collection.Remove(1)); 5996Assert.Throws<ArgumentException>(() => collection.Remove(1)); 5997Assert.Throws<ArgumentException>(() => collection.Remove(2)); 6865Assert.Throws<ArgumentException>(() => collection.RemoveAt(1)); 6876Assert.Throws<ArgumentException>(() => collection.RemoveAt(1)); 10355Assert.Throws<ArgumentException>(() => collection.Insert(0, 1)); 10372Assert.Throws<OutOfMemoryException>(() => collection.Insert(0, 1)); 11307Assert.Throws<ArgumentException>(() => collection.Remove(1)); 11318Assert.Throws<ArgumentException>(() => collection.Remove(1)); 11319Assert.Throws<ArgumentException>(() => collection.Remove(2)); 12187Assert.Throws<ArgumentException>(() => collection.RemoveAt(1)); 12198Assert.Throws<ArgumentException>(() => collection.RemoveAt(1));
System\Windows\Forms\ListBox.SelectedIndexCollectionTests.cs (4)
81Assert.Throws<NotSupportedException>(collection.Clear); 98Assert.Throws<NotSupportedException>(() => collection.Insert(index, value)); 109Assert.Throws<NotSupportedException>(() => collection.Remove(value)); 120Assert.Throws<NotSupportedException>(() => collection.RemoveAt(index));
System\Windows\Forms\ListBox.SelectedObjectCollectionTests.cs (4)
81Assert.Throws<NotSupportedException>(collection.Clear); 98Assert.Throws<NotSupportedException>(() => collection.Insert(index, value)); 109Assert.Throws<NotSupportedException>(() => collection.Remove(value)); 120Assert.Throws<NotSupportedException>(() => collection.RemoveAt(index));
System\Windows\Forms\ListViewGroupCollectionTests.cs (3)
851Assert.Throws<ArgumentException>(() => collection.Insert(0, group)); 1115Assert.Throws<InvalidOperationException>(() => listView.Groups.AddRange(sourceGroup)); 1131Assert.Throws<InvalidOperationException>(() => listView.Groups.Insert(0, new ListViewGroup()));
System\Windows\Forms\NativeWindowTests.cs (4)
165Assert.Throws<NullReferenceException>(() => window.CreateHandle(null)); 178Assert.Throws<InvalidOperationException>(() => window.CreateHandle(cp)); 192Assert.Throws<Win32Exception>(() => window.CreateHandle(cp)); 214Assert.Throws<Win32Exception>(() => window2.CreateHandle(cp2));
System\Windows\Forms\NotifyIconTests.cs (2)
965Assert.Throws<ArgumentException>(() => notifyIcon.ShowBalloonTip(0)); 966Assert.Throws<ArgumentException>(() => notifyIcon.ShowBalloonTip(0, "Title", tipText, ToolTipIcon.Error));
System\Windows\Forms\PictureBoxTests.cs (6)
1963Assert.Throws<InvalidOperationException>(() => pictureBox.Load(null)); 1969Assert.Throws<InvalidOperationException>(() => pictureBox.Load(string.Empty)); 2120Assert.Throws<InvalidOperationException>(pictureBox.Load); 2121Assert.Throws<InvalidOperationException>(() => pictureBox.Load(imageLocation)); 2132Assert.Throws<InvalidOperationException>(pictureBox.LoadAsync); 2133Assert.Throws<InvalidOperationException>(() => pictureBox.LoadAsync(imageLocation));
System\Windows\Forms\ProgressBarTests.cs (2)
1897Assert.Throws<InvalidOperationException>(() => control.Increment(value)); 2553Assert.Throws<InvalidOperationException>(control.PerformStep);
System\Windows\Forms\PropertyGridTests.cs (2)
3743Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 3843Assert.Throws<NullReferenceException>(() => control.OnMouseMove(null));
System\Windows\Forms\PropertyManagerTests.cs (2)
394Assert.Throws<NotSupportedException>(manager.AddNew); 404Assert.Throws<NotSupportedException>(() => manager.RemoveAt(index));
System\Windows\Forms\RadioButtonTests.cs (1)
1270Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null));
System\Windows\Forms\RichTextBoxTests.cs (3)
8780Assert.Throws<ArgumentException>(() => control.LoadFile(stream, fileType)); 8789Assert.Throws<ArgumentException>(() => control.LoadFile(stream, RichTextBoxStreamType.RichText)); 8803Assert.Throws<ArgumentException>(() => control.LoadFile(stream, RichTextBoxStreamType.RichText));
System\Windows\Forms\ScrollableControlTests.cs (1)
1886Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null));
System\Windows\Forms\SplitterTests.cs (1)
2175Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null));
System\Windows\Forms\StatusStripTests.cs (2)
1194Assert.Throws<NullReferenceException>(() => control.OnLayout(null)); 1244Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null));
System\Windows\Forms\TabControl.ControlCollectionTests.cs (2)
876Assert.Throws<ArgumentException>(() => collection.Add(value)); 884Assert.Throws<ArgumentNullException>(() => collection.Add(null));
System\Windows\Forms\TabControl.TabPageCollectionTests.cs (6)
1292Assert.Throws<InvalidCastException>(() => iList.CopyTo(array, 1)); 2948Assert.Throws<ArgumentOutOfRangeException>(() => collection.Insert(index, value)); 2961Assert.Throws<ArgumentOutOfRangeException>(() => collection.Insert(index, value)); 3143Assert.Throws<ArgumentException>(() => iList.Insert(0, value)); 3179Assert.Throws<ArgumentOutOfRangeException>(() => iList.Insert(index, value)); 3193Assert.Throws<ArgumentOutOfRangeException>(() => iList.Insert(index, value));
System\Windows\Forms\TableLayoutPanelTests.cs (2)
1405Assert.Throws<NullReferenceException>(() => control.OnLayout(null)); 1539Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null));
System\Windows\Forms\TableLayoutStyleCollectionTests.cs (2)
107Assert.Throws<ArgumentException>(() => collection.Insert(0, new object())); 217Assert.Throws<ArgumentException>(() => collection.Remove(new object()));
System\Windows\Forms\TabPageTests.cs (1)
4254Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null));
System\Windows\Forms\TabPageTests.TabPageControlCollection.cs (1)
107Assert.Throws<ArgumentException>(() => collection.Add(control));
System\Windows\Forms\ToolStripButtonTests.cs (1)
1508Assert.Throws<NullReferenceException>(() => item.OnPaint(null));
System\Windows\Forms\ToolStripContentPanelTests.cs (1)
1887Assert.Throws<NullReferenceException>(() => control.OnPaintBackground(null));
System\Windows\Forms\ToolStripControlHostTests.cs (6)
354TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => property.ResetValue(item)); 1030TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => property.ResetValue(item)); 1173TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => property.ResetValue(item)); 2705Assert.Throws<ObjectDisposedException>(item.Focus); 4415Assert.Throws<ObjectDisposedException>(item.ResetBackColor); 4448Assert.Throws<ObjectDisposedException>(item.ResetForeColor);
System\Windows\Forms\ToolStripDropDownTests.cs (1)
4765Assert.Throws<NullReferenceException>(() => control.OnScroll(null));
System\Windows\Forms\ToolStripSeparatorTests.cs (1)
1348Assert.Throws<NullReferenceException>(() => item.OnPaint(null));
System\Windows\Forms\ToolStripTests.cs (8)
5842Assert.Throws<NullReferenceException>(() => control.OnPaint(null)); 6225Assert.Throws<ArgumentNullException>(() => control.OnPaintBackground(null)); 6304Assert.Throws<NullReferenceException>(() => control.OnPaintGrip(null)); 6770Assert.Throws<NullReferenceException>(() => control.OnScroll(null)); 7105Assert.Throws<NotSupportedException>(() => control.SetItemLocation(item, Point.Empty)); 7117Assert.Throws<NotSupportedException>(() => control.SetItemLocation(item, Point.Empty)); 7128Assert.Throws<NotSupportedException>(() => control.SetItemLocation(item, Point.Empty)); 7140Assert.Throws<NotSupportedException>(() => control.SetItemLocation(item, Point.Empty));
System\Windows\Forms\TreeViewTests.cs (3)
5845Assert.Throws<NullReferenceException>(() => control.OnKeyDown(null)); 5890Assert.Throws<NullReferenceException>(() => control.OnKeyPress(null)); 5937Assert.Throws<NullReferenceException>(() => control.OnKeyUp(null));
System\Windows\Forms\UpDownBaseTests.cs (6)
2041Assert.Throws<NullReferenceException>(() => control.OnMouseDown(null)); 2168Assert.Throws<NullReferenceException>(() => control.OnMouseUp(null)); 2220Assert.Throws<NullReferenceException>(() => control.OnMouseWheel(null)); 2336Assert.Throws<NullReferenceException>(() => control.OnPaint(null)); 2348Assert.Throws<ArgumentNullException>(() => control.OnPaint(null)); 2423Assert.Throws<NullReferenceException>(() => control.OnTextBoxKeyDown(new object(), null));
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (2)
529Assert.Throws<ArgumentException>(() => renderer.SetParameters(element.ClassName, element.Part, element.State)); 557Assert.Throws<ArgumentException>(() => renderer.SetParameters(element));
System\Windows\Forms\WebBrowserTests.cs (21)
2376Assert.Throws<InvalidCastException>(() => control.AttachInterfaces(new object())); 3123Assert.Throws<ObjectDisposedException>(control.GoHome); 3135Assert.Throws<InvalidOperationException>(control.GoHome); 3172Assert.Throws<ObjectDisposedException>(control.GoSearch); 3184Assert.Throws<InvalidOperationException>(control.GoSearch); 3459Assert.Throws<ArgumentException>(() => control.Navigate(relativeUri)); 3460Assert.Throws<ArgumentException>(() => control.Navigate(relativeUri, "targetFrameName")); 3461Assert.Throws<ArgumentException>(() => control.Navigate(relativeUri, false)); 3462Assert.Throws<ArgumentException>(() => control.Navigate(relativeUri, "targetFrameName", null, null)); 3474Assert.Throws<ObjectDisposedException>(() => control.Navigate("about:blank")); 3475Assert.Throws<ObjectDisposedException>(() => control.Navigate(new Uri("http://google.com"))); 3476Assert.Throws<ObjectDisposedException>(() => control.Navigate(new Uri("http://google.com"), "targetFrameName")); 3477Assert.Throws<ObjectDisposedException>(() => control.Navigate(new Uri("http://google.com"), false)); 3478Assert.Throws<ObjectDisposedException>(() => control.Navigate(new Uri("http://google.com"), "targetFrameName", null, null)); 3490Assert.Throws<InvalidOperationException>(() => control.Navigate("about:blank")); 3491Assert.Throws<InvalidOperationException>(() => control.Navigate(new Uri("http://google.com"))); 3492Assert.Throws<InvalidOperationException>(() => control.Navigate(new Uri("http://google.com"), "targetFrameName")); 3493Assert.Throws<InvalidOperationException>(() => control.Navigate(new Uri("http://google.com"), false)); 3494Assert.Throws<InvalidOperationException>(() => control.Navigate(new Uri("http://google.com"), "targetFrameName", null, null)); 3648Assert.Throws<ObjectDisposedException>(() => control.OnDocumentCompleted(null)); 3660Assert.Throws<InvalidOperationException>(() => control.OnDocumentCompleted(null));
System\Windows\Forms\WindowsFormsSynchronizationContextTests.cs (1)
87Assert.Throws<InvalidAsynchronousStateException>(() => context.Send(callback, new object()));
TrackBarTests.cs (1)
2600Assert.Throws<NullReferenceException>(() => control.OnMouseWheel(null));
WebBrowserBaseTests.cs (43)
290Assert.Throws<NotSupportedException>(() => control.BackColorChanged += handler); 299Assert.Throws<NotSupportedException>(() => control.BackgroundImageChanged += handler); 308Assert.Throws<NotSupportedException>(() => control.BackgroundImageLayoutChanged += handler); 317Assert.Throws<NotSupportedException>(() => control.BindingContextChanged += handler); 326Assert.Throws<NotSupportedException>(() => control.ChangeUICues += handler); 335Assert.Throws<NotSupportedException>(() => control.Click += handler); 344Assert.Throws<NotSupportedException>(() => control.CursorChanged += handler); 353Assert.Throws<NotSupportedException>(() => control.DoubleClick += handler); 362Assert.Throws<NotSupportedException>(() => control.DragDrop += handler); 371Assert.Throws<NotSupportedException>(() => control.DragEnter += handler); 380Assert.Throws<NotSupportedException>(() => control.DragLeave += handler); 389Assert.Throws<NotSupportedException>(() => control.DragOver += handler); 398Assert.Throws<NotSupportedException>(() => control.EnabledChanged += handler); 407Assert.Throws<NotSupportedException>(() => control.Enter += handler); 416Assert.Throws<NotSupportedException>(() => control.FontChanged += handler); 425Assert.Throws<NotSupportedException>(() => control.ForeColorChanged += handler); 434Assert.Throws<NotSupportedException>(() => control.GiveFeedback += handler); 443Assert.Throws<NotSupportedException>(() => control.HelpRequested += handler); 452Assert.Throws<NotSupportedException>(() => control.ImeModeChanged += handler); 461Assert.Throws<NotSupportedException>(() => control.KeyDown += handler); 470Assert.Throws<NotSupportedException>(() => control.KeyPress += handler); 479Assert.Throws<NotSupportedException>(() => control.KeyUp += handler); 488Assert.Throws<NotSupportedException>(() => control.Layout += handler); 497Assert.Throws<NotSupportedException>(() => control.Leave += handler); 506Assert.Throws<NotSupportedException>(() => control.MouseCaptureChanged += handler); 515Assert.Throws<NotSupportedException>(() => control.MouseClick += handler); 524Assert.Throws<NotSupportedException>(() => control.MouseDoubleClick += handler); 533Assert.Throws<NotSupportedException>(() => control.MouseDown += handler); 542Assert.Throws<NotSupportedException>(() => control.MouseEnter += handler); 551Assert.Throws<NotSupportedException>(() => control.MouseHover += handler); 560Assert.Throws<NotSupportedException>(() => control.MouseLeave += handler); 569Assert.Throws<NotSupportedException>(() => control.MouseMove += handler); 578Assert.Throws<NotSupportedException>(() => control.MouseUp += handler); 587Assert.Throws<NotSupportedException>(() => control.MouseWheel += handler); 596Assert.Throws<NotSupportedException>(() => control.Paint += handler); 605Assert.Throws<NotSupportedException>(() => control.QueryAccessibilityHelp += handler); 614Assert.Throws<NotSupportedException>(() => control.QueryContinueDrag += handler); 623Assert.Throws<NotSupportedException>(() => control.RightToLeftChanged += handler); 632Assert.Throws<NotSupportedException>(() => control.StyleChanged += handler); 641Assert.Throws<NotSupportedException>(() => control.TextChanged += handler); 724Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(x, y, width, height))); 738Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(1, 2, 3, 4))); 752Assert.Throws<ArgumentException>(() => control.DrawToBitmap(bitmap, new Rectangle(1, 2, 3, 4)));
xunit.assert (1)
ExceptionAsserts.cs (1)
141 var ex = Throws<T>(testCode);