3121 references to Throws
Aspire.Azure.Messaging.WebPubSub.Tests (1)
AspireWebPubSubExtensionsTests.cs (1)
151var ex = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<WebPubSubServiceClient>);
Aspire.Components.Common.Tests (2)
ConformanceTests.cs (2)
249Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TService>); 367Assert.Throws<InvalidOperationException>(() =>
Aspire.Hosting.Azure.Tests (4)
AzureBicepResourceTests.cs (3)
162Assert.Throws<InvalidOperationException>(() => bicepResource.GetOutput("resourceEndpoint").Value); 172Assert.Throws<InvalidOperationException>(() => bicepResource.GetSecretOutput("connectionString").Value); 2757var ex = Assert.Throws<ArgumentNullException>(() => provisioningResource.ConfigureInfrastructure(null!));
AzureWebPubSubExtensionsTests.cs (1)
21var ex = Assert.Throws<ArgumentException>(() => wps.AddHub("a_b_c"));
Aspire.Hosting.Elasticsearch.Tests (6)
ElasticsearchPublicApiTests.cs (6)
19var exception = Assert.Throws<ArgumentNullException>(action); 31var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 69var exception = Assert.Throws<ArgumentNullException>(action); 83var exception = Assert.Throws<ArgumentNullException>(action); 94var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Garnet.Tests (7)
GarnetPublicApiTests.cs (7)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 79var exception = Assert.Throws<ArgumentNullException>(action); 90var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Kafka.Tests (9)
KafkaPublicApiTests.cs (9)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 79var exception = Assert.Throws<ArgumentNullException>(action); 90var exception = Assert.Throws<ArgumentNullException>(action); 101var exception = Assert.Throws<ArgumentNullException>(action); 112var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Keycloak.Tests (10)
KeycloakPublicApiTests.cs (10)
21var exception = Assert.Throws<ArgumentNullException>(action); 33var exception = Assert.Throws<ArgumentNullException>(action); 45var exception = Assert.Throws<ArgumentNullException>(action); 57var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 80var exception = Assert.Throws<ArgumentNullException>(action); 93var exception = Assert.Throws<ArgumentNullException>(action); 105var exception = Assert.Throws<ArgumentNullException>(action); 118var exception = Assert.Throws<ArgumentNullException>(action); 130Assert.Throws<DirectoryNotFoundException>(action);
Aspire.Hosting.Milvus.Tests (12)
MilvusPublicApiTests.cs (12)
20var exception = Assert.Throws<ArgumentNullException>(action); 34var exception = Assert.Throws<ArgumentNullException>(action); 50var exception = Assert.Throws<ArgumentNullException>(action); 62var exception = Assert.Throws<ArgumentNullException>(action); 73var exception = Assert.Throws<ArgumentNullException>(action); 84var exception = Assert.Throws<ArgumentNullException>(action); 96var exception = Assert.Throws<ArgumentNullException>(action); 112var exception = Assert.Throws<ArgumentNullException>(action); 123var exception = Assert.Throws<ArgumentNullException>(action); 138var exception = Assert.Throws<ArgumentNullException>(action); 151var exception = Assert.Throws<ArgumentNullException>(action); 163var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.MongoDB.Tests (18)
AddMongoDBTests.cs (2)
237Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db")); 249Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db"));
MongoDBPublicApiTests.cs (16)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 44var exception = Assert.Throws<ArgumentNullException>(action); 57var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 80var exception = Assert.Throws<ArgumentNullException>(action); 93var exception = Assert.Throws<ArgumentNullException>(action); 104var exception = Assert.Throws<ArgumentNullException>(action); 115var exception = Assert.Throws<ArgumentNullException>(action); 128var exception = Assert.Throws<ArgumentNullException>(action); 139var exception = Assert.Throws<ArgumentNullException>(action); 150var exception = Assert.Throws<ArgumentNullException>(action); 163var exception = Assert.Throws<ArgumentNullException>(action); 176var exception = Assert.Throws<ArgumentNullException>(action); 189var exception = Assert.Throws<ArgumentNullException>(action); 200var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.MySql.Tests (15)
AddMySqlTests.cs (2)
306Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db")); 318Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db"));
MySqlPublicApiTests.cs (13)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 80var exception = Assert.Throws<ArgumentNullException>(action); 93var exception = Assert.Throws<ArgumentNullException>(action); 105var exception = Assert.Throws<ArgumentNullException>(action); 118var exception = Assert.Throws<ArgumentNullException>(action); 129var exception = Assert.Throws<ArgumentNullException>(action); 139var exception = Assert.Throws<ArgumentNullException>(action); 153var exception = Assert.Throws<ArgumentNullException>(action); 165var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Nats.Tests (8)
NatsPublicApiTests.cs (8)
22var exception = Assert.Throws<ArgumentNullException>(action); 36var exception = Assert.Throws<ArgumentNullException>(action); 47var exception = Assert.Throws<ArgumentNullException>(action); 58var exception = Assert.Throws<ArgumentNullException>(action); 70var exception = Assert.Throws<ArgumentNullException>(action); 83var exception = Assert.Throws<ArgumentNullException>(action); 94var exception = Assert.Throws<ArgumentNullException>(action); 108var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.NodeJs.Tests (10)
NodeJsPublicApiTests.cs (10)
19var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 45var exception = Assert.Throws<ArgumentNullException>(action); 58var exception = Assert.Throws<ArgumentNullException>(action); 71var exception = Assert.Throws<ArgumentNullException>(action); 84var exception = Assert.Throws<ArgumentNullException>(action); 98var exception = Assert.Throws<ArgumentNullException>(action); 111var exception = Assert.Throws<ArgumentNullException>(action); 124var exception = Assert.Throws<ArgumentNullException>(action); 137var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Oracle.Tests (2)
AddOracleTests.cs (2)
272Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db")); 284Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db"));
Aspire.Hosting.PostgreSQL.Tests (19)
AddPostgresTests.cs (2)
557Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db")); 569Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db"));
PostgrePublicApiTests.cs (17)
21var exception = Assert.Throws<ArgumentNullException>(action); 34var exception = Assert.Throws<ArgumentNullException>(action); 46var exception = Assert.Throws<ArgumentNullException>(action); 58var exception = Assert.Throws<ArgumentNullException>(action); 69var exception = Assert.Throws<ArgumentNullException>(action); 84var exception = Assert.Throws<ArgumentNullException>(action); 99var exception = Assert.Throws<ArgumentNullException>(action); 112var exception = Assert.Throws<ArgumentNullException>(action); 125var exception = Assert.Throws<ArgumentNullException>(action); 137var exception = Assert.Throws<ArgumentNullException>(action); 149var exception = Assert.Throws<ArgumentNullException>(action); 162var exception = Assert.Throws<ArgumentNullException>(action); 173var exception = Assert.Throws<ArgumentNullException>(action); 184var exception = Assert.Throws<ArgumentNullException>(action); 196var exception = Assert.Throws<ArgumentNullException>(action); 209var exception = Assert.Throws<ArgumentNullException>(action); 220var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Python.Tests (14)
PythonPublicApiTests.cs (14)
20var exception = Assert.Throws<ArgumentNullException>(action); 33var exception = Assert.Throws<ArgumentNullException>(action); 46var exception = Assert.Throws<ArgumentNullException>(action); 65var exception = Assert.Throws<ArgumentNullException>(action); 84var exception = Assert.Throws<ArgumentNullException>(action); 103var exception = Assert.Throws<ArgumentNullException>(action); 122var exception = Assert.Throws<ArgumentNullException>(action); 141var exception = Assert.Throws<ArgumentNullException>(action); 162var exception = Assert.Throws<ArgumentNullException>(action); 183var exception = Assert.Throws<ArgumentNullException>(action); 204var exception = Assert.Throws<ArgumentNullException>(action); 225var exception = Assert.Throws<ArgumentNullException>(action); 246var exception = Assert.Throws<ArgumentNullException>(action); 267var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Qdrant.Tests (9)
QdrantPublicApiTests.cs (9)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 81var exception = Assert.Throws<ArgumentNullException>(action); 94var exception = Assert.Throws<ArgumentNullException>(action); 108var exception = Assert.Throws<ArgumentNullException>(action); 120var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.RabbitMQ.Tests (12)
AddRabbitMQTests.cs (3)
162Assert.Throws<DistributedApplicationException>(rabbitmq.WithManagementPlugin); 176Assert.Throws<DistributedApplicationException>(rabbitmq.WithManagementPlugin); 190Assert.Throws<DistributedApplicationException>(rabbitmq.WithManagementPlugin);
RabbitMQPublicApiTests.cs (9)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 55var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 79var exception = Assert.Throws<ArgumentNullException>(action); 90var exception = Assert.Throws<ArgumentNullException>(action); 103var exception = Assert.Throws<ArgumentNullException>(action); 116var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Redis.Tests (12)
RedisPublicApiTests.cs (12)
22var exception = Assert.Throws<ArgumentNullException>(action); 34var exception = Assert.Throws<ArgumentNullException>(action); 45var exception = Assert.Throws<ArgumentNullException>(action); 56var exception = Assert.Throws<ArgumentNullException>(action); 68var exception = Assert.Throws<ArgumentNullException>(action); 80var exception = Assert.Throws<ArgumentNullException>(action); 91var exception = Assert.Throws<ArgumentNullException>(action); 103var exception = Assert.Throws<ArgumentNullException>(action); 116var exception = Assert.Throws<ArgumentNullException>(action); 127var exception = Assert.Throws<ArgumentNullException>(action); 142var exception = Assert.Throws<ArgumentNullException>(action); 157var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.SqlServer.Tests (14)
AddSqlServerTests.cs (2)
205Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db")); 217Assert.Throws<DistributedApplicationException>(() => db.AddDatabase("db"));
SqlServerPublicApiTests.cs (12)
20var exception = Assert.Throws<ArgumentNullException>(action); 32var exception = Assert.Throws<ArgumentNullException>(action); 44var exception = Assert.Throws<ArgumentNullException>(action); 81var exception = Assert.Throws<ArgumentNullException>(action); 93var exception = Assert.Throws<ArgumentNullException>(action); 106var exception = Assert.Throws<ArgumentNullException>(action); 120var exception = Assert.Throws<ArgumentNullException>(action); 135var exception = Assert.Throws<ArgumentNullException>(action); 150var exception = Assert.Throws<ArgumentException>(action); 165var exception = Assert.Throws<ArgumentNullException>(action); 180var exception = Assert.Throws<ArgumentNullException>(action); 195var exception = Assert.Throws<ArgumentNullException>(action);
Aspire.Hosting.Testing.Tests (1)
TestingBuilderTests.cs (1)
176Assert.Throws<InvalidOperationException>(() => app.CreateHttpClient("mywebapp1"));
Aspire.Hosting.Tests (9)
AddParameterTests.cs (2)
225var ex1 = Assert.Throws<ArgumentException>(() => appBuilder.AddParameter("pass", () => "SomeSecret", publishValueAsDefault: true, secret: true)); 227var ex2 = Assert.Throws<ArgumentException>(() => appBuilder.AddParameter("pass", "SomeSecret", publishValueAsDefault: true, secret: true));
DistributedApplicationBuilderTests.cs (4)
133var ex = Assert.Throws<DistributedApplicationException>(() => appBuilder.AddResource(new ContainerResource("Test"))); 144var ex = Assert.Throws<DistributedApplicationException>(() => appBuilder.AddResource(new ContainerResource("TEST"))); 156var ex = Assert.Throws<DistributedApplicationException>(appBuilder.Build); 168var ex = Assert.Throws<DistributedApplicationException>(appBuilder.Build);
ProjectResourceTests.cs (2)
271var ex = Assert.Throws<DistributedApplicationException>(() => appBuilder.AddProject<TestProject>("projectName")); 280var ex = Assert.Throws<DistributedApplicationException>(() => appBuilder.AddProject<Projects.ServiceA>("projectName", launchProfileName: "not-exist"));
WithEndpointTests.cs (1)
236var ex = Assert.Throws<InvalidOperationException>(() =>
Aspire.Keycloak.Authentication.Tests (4)
AspireKeycloakExtensionTests.cs (4)
29var exception = Assert.Throws<InvalidOperationException>(() => 49var exception = Assert.Throws<InvalidOperationException>(() => 110var exception = Assert.Throws<InvalidOperationException>(() => 130var exception = Assert.Throws<InvalidOperationException>(() =>
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
EnrichCosmosDbTests.cs (1)
135var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (2)
EnrichSqlServerTests.cs (2)
109var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 304var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (2)
EnrichNpgsqlTests.cs (2)
112var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 315var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
Aspire.OpenAI.Tests (1)
AspireOpenAIExtensionsTests.cs (1)
103var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<OpenAIClient>);
Aspire.Oracle.EntityFrameworkCore.Tests (2)
EnrichOracleDatabaseTests.cs (2)
110var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 305var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (2)
EnrichMySqlTests.cs (2)
123var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 318var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
IIS.Tests (1)
MaxRequestBodySizeTests.cs (1)
251invalidOpEx = Assert.Throws<InvalidOperationException>(() =>
InMemory.FunctionalTests (19)
ChunkedRequestTests.cs (6)
243Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header")); // Not yet 250Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header")); // Not yet 258Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header")); 369Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header")); // Not yet 376Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header")); // Not yet 384Assert.Throws<InvalidOperationException>(() => request.GetTrailer("X-Trailer-Header"));
Http2\Http2StreamTests.cs (3)
2145Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type"); 2473Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"); 2474Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Tag");
Http3\Http3StreamTests.cs (3)
863Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type"); 1017Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"); 1018Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Tag");
MaxRequestBodySizeTests.cs (2)
297invalidOpEx = Assert.Throws<InvalidOperationException>(() => 337invalidOpEx = Assert.Throws<InvalidOperationException>(() =>
RequestTests.cs (2)
1698var ioEx = Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(new byte[1], 0, 1)); 1791var ioEx = Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(new byte[1], 0, 1));
ResponseHeaderTests.cs (2)
24Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type"); // Special cased 25Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Accept = "Custom 你好 Accept"); // Not special cased
ResponseTests.cs (1)
4276writeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.GetMemory());
Microsoft.AspNetCore.Antiforgery.Test (1)
AntiforgeryApplicationBuilderExtensionsTest.cs (1)
41var exception = Assert.Throws<InvalidOperationException>(() => builder.UseAntiforgery());
Microsoft.AspNetCore.AsyncState.Tests (2)
AsyncContextHttpContextOfTTests.cs (1)
78Assert.Throws<InvalidOperationException>(() => _context.Get());
AsyncStateHttpContextExtensionsTests.cs (1)
18Assert.Throws<ArgumentNullException>(() => AsyncStateHttpContextExtensions.AddAsyncStateHttpContext(null!));
Microsoft.AspNetCore.Authentication.Core.Test (1)
AuthenticationSchemeProviderTests.cs (1)
153var error = Assert.Throws<InvalidOperationException>(() => services.GetRequiredService<IAuthenticationSchemeProvider>());
Microsoft.AspNetCore.Authentication.Test (2)
CookieTests.cs (1)
293Assert.Throws<OptionsValidationException>(() => options.Get(CookieAuthenticationDefaults.AuthenticationScheme));
OpenIdConnect\OpenIdConnectTests.cs (1)
510Assert.Throws<FormatException>(() =>
Microsoft.AspNetCore.Authorization.Test (2)
AuthorizationPolicyFacts.cs (1)
14Assert.Throws<InvalidOperationException>(() => new AuthorizationPolicyBuilder().RequireRole());
DefaultAuthorizationServiceTests.cs (1)
482Assert.Throws<InvalidOperationException>(() => BuildAuthorizationService(services =>
Microsoft.AspNetCore.Components.Forms.Tests (10)
EditContextDataAnnotationsExtensionsTest.cs (1)
17var ex = Assert.Throws<ArgumentNullException>(() => editContext.EnableDataAnnotationsValidation(_serviceProvider));
EditContextTest.cs (4)
11var ex = Assert.Throws<ArgumentNullException>(() => new EditContext(null)); 281Assert.Throws<KeyNotFoundException>(() => editContext.Properties[key1]); 290Assert.Throws<KeyNotFoundException>(() => editContext.Properties[key3]); 336Assert.Throws<KeyNotFoundException>(() => editContext.Properties[key]);
FieldIdentifierTest.cs (4)
15var ex = Assert.Throws<ArgumentNullException>(() => new FieldIdentifier(null, "somefield")); 22var ex = Assert.Throws<ArgumentException>(() => new FieldIdentifier(DateTime.Now, "somefield")); 30var ex = Assert.Throws<ArgumentNullException>(() => new FieldIdentifier(new object(), null)); 164var ex = Assert.Throws<ArgumentException>(() =>
ValidationMessageStoreTest.cs (1)
11var ex = Assert.Throws<ArgumentNullException>(() => new ValidationMessageStore(null));
Microsoft.AspNetCore.Components.Server.Tests (1)
src\SignalR\common\SignalR.Common\test\Internal\Protocol\MessagePackHubProtocolTestBase.cs (1)
364var exception = Assert.Throws<InvalidDataException>(() => HubProtocol.TryParseMessage(ref data, binder, out _));
Microsoft.AspNetCore.Components.Tests (18)
CascadingParameterTest.cs (1)
566var ex = Assert.Throws<InvalidOperationException>(() => renderer.AssignRootComponentId(component));
EventCallbackFactoryBinderExtensionsTest.cs (1)
605var ex = Assert.Throws<InvalidOperationException>(() => EventCallback.Factory.CreateBinder(component, setter, value));
NavigationManagerTest.cs (3)
140var exception = Assert.Throws<InvalidOperationException>(() => navigationManager.GetUriWithQueryParameter(name, "test")); 193var exception = Assert.Throws<InvalidOperationException>(() => navigationManager.GetUriWithQueryParameters(unsupportedParameterValues)); 209var exception = Assert.Throws<InvalidOperationException>(() => navigationManager.GetUriWithQueryParameters(values));
ParameterViewTest.cs (4)
336Assert.Throws<InvalidOperationException>(() => parameterView.GetEnumerator()); 337Assert.Throws<InvalidOperationException>(() => parameterView.GetValueOrDefault<object>("anything")); 339Assert.Throws<InvalidOperationException>(() => parameterView.ToDictionary()); 340var ex = Assert.Throws<InvalidOperationException>(() => parameterView.TryGetValue<object>("anything", out _));
RendererTest.cs (6)
663var ex = Assert.Throws<InvalidOperationException>(() => renderer.GetEventArgsType(eventHandlerId)); 686var ex = Assert.Throws<InvalidOperationException>(() => renderer.GetEventArgsType(eventHandlerId)); 4458Assert.Throws<InvalidOperationException>(() => parameterView.GetEnumerator()); 4459Assert.Throws<InvalidOperationException>(() => parameterView.GetValueOrDefault<object>("anything")); 4461Assert.Throws<InvalidOperationException>(parameterView.ToDictionary); 4462var ex = Assert.Throws<InvalidOperationException>(() => parameterView.TryGetValue<object>("anything", out _));
RenderTreeDiffBuilderTest.cs (3)
398var ex = Assert.Throws<InvalidOperationException>(() => GetSingleUpdatedComponent()); 415var ex = Assert.Throws<InvalidOperationException>(() => GetSingleUpdatedComponent()); 432var ex = Assert.Throws<InvalidOperationException>(() => GetSingleUpdatedComponent());
Microsoft.AspNetCore.Components.Web.Tests (3)
Forms\InputFileChangeEventArgsTest.cs (3)
30var ex = Assert.Throws<InvalidOperationException>(() => instance.File); 38var ex = Assert.Throws<InvalidOperationException>(() => instance.File); 62var ex = Assert.Throws<InvalidOperationException>(() => instance.GetMultipleFiles(1));
Microsoft.AspNetCore.Components.WebAssembly.Tests (1)
Hosting\WebAssemblyHostBuilderTest.cs (1)
106Assert.Throws<InvalidOperationException>(() => host.Services.GetRequiredService<TestServiceThatTakesStringBuilder>());
Microsoft.AspNetCore.CookiePolicy.Test (1)
CookieChunkingTests.cs (1)
182Assert.Throws<FormatException>(() => new ChunkingCookieManager() { ThrowForPartialCookies = true }
Microsoft.AspNetCore.Cors.Test (3)
CorsPolicyBuilderTests.cs (3)
145Assert.Throws<ArgumentNullException>(() => builder.WithOrigins(args)); 156Assert.Throws<ArgumentNullException>(() => builder.WithOrigins(args)); 342var ex = Assert.Throws<InvalidOperationException>(() => builder.Build());
Microsoft.AspNetCore.DataProtection.Abstractions.Tests (1)
DataProtectionCommonExtensionsTests.cs (1)
116var ex = Assert.Throws<InvalidOperationException>(() => services.GetDataProtectionProvider());
Microsoft.AspNetCore.DataProtection.Extensions.Tests (2)
DataProtectionProviderTests.cs (1)
199Assert.Throws<CryptographicException>(() => keylessUnprotector.Unprotect(data));
TimeLimitedDataProtectorTests.cs (1)
170Assert.Throws<CryptographicException>(() => ephemeralProtector.Unprotect(timeLimitedProtectedPayload));
Microsoft.AspNetCore.DataProtection.Tests (10)
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
125var ex = Assert.Throws<InvalidOperationException>(() => new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)));
Internal\KeyManagementOptionsPostSetupTest.cs (1)
172Assert.Throws<InvalidOperationException>(() => options.XmlEncryptor.Encrypt(xElement));
KeyManagement\KeyRingProviderTests.cs (2)
183Assert.Throws<InvalidOperationException>(() => keyRingProvider.GetCacheableKeyRing(now)); // The would-be default key is revoked 264var exception = Assert.Throws<InvalidOperationException>(() => keyRingProvider.GetCacheableKeyRing(now));
KeyManagement\XmlKeyManagerTests.cs (2)
592Assert.Throws<FormatException>(() => RunGetAllKeysCore(xml, new Mock<IActivator>().Object)); 998Assert.Throws<NotSupportedException>(() => withoutDeletion.DeleteKeys(_ => false));
ServiceCollectionTests.cs (1)
106Assert.Throws<InvalidOperationException>(() => options.XmlEncryptor.Encrypt(xElement));
XmlEncryption\EncryptedXmlDecryptorTests.cs (3)
24var ex = Assert.Throws<CryptographicException>(() => 42var ex = Assert.Throws<CryptographicException>(() => 60var ex = Assert.Throws<CryptographicException>(() =>
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (2)
HealthCheckMiddlewareTests.cs (2)
936var exception = Assert.Throws<InvalidOperationException>(() => 947var exception = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (13)
Latency\RequestCheckpointExtensionsTests.cs (2)
17Assert.Throws<ArgumentNullException>(() => Extensions.DependencyInjection.RequestLatencyTelemetryServiceCollectionExtensions.AddRequestCheckpoint(null!)); 23Assert.Throws<ArgumentNullException>(() => Builder.RequestLatencyTelemetryApplicationBuilderExtensions.UseRequestCheckpoint(null!));
Latency\RequestLatencyTelemetryExtensionsTests.cs (4)
20Assert.Throws<ArgumentNullException>(() => 22Assert.Throws<ArgumentNullException>(() => 24Assert.Throws<ArgumentNullException>(() => 26Assert.Throws<ArgumentNullException>(() =>
Logging\HttpLoggingServiceExtensionsTests.cs (2)
25Assert.Throws<ArgumentNullException>(static () => HttpLoggingServiceCollectionExtensions.AddHttpLogEnricher<TestHttpLogEnricher>(null!)); 27Assert.Throws<ArgumentNullException>(
Logging\LoggingOptionsValidationTests.cs (1)
28var ex = Assert.Throws<InvalidOperationException>(
Logging\RequestHeadersEnricherExtensionsTests.cs (4)
18Assert.Throws<ArgumentNullException>(() => 21Assert.Throws<ArgumentNullException>(() => 24Assert.Throws<ArgumentNullException>(() => 35Assert.Throws<ArgumentNullException>(() => sp.GetRequiredService<ILogEnricher>());
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (6)
JsonTranscodingServiceMethodProviderTests.cs (6)
97var ex = Assert.Throws<InvalidOperationException>(() => FindGrpcEndpoint(endpoints, nameof(JsonTranscodingGreeterService.NoOption))); 166var ex = Assert.Throws<InvalidOperationException>(() => MapEndpoints<JsonTranscodingInvalidResponseBodyGreeterService>()); 178var ex = Assert.Throws<InvalidOperationException>(() => MapEndpoints<JsonTranscodingInvalidNestedResponseBodyGreeterService>()); 190var ex = Assert.Throws<InvalidOperationException>(() => MapEndpoints<JsonTranscodingInvalidBodyGreeterService>()); 202var ex = Assert.Throws<InvalidOperationException>(() => MapEndpoints<JsonTranscodingInvalidNestedBodyGreeterService>()); 214var ex = Assert.Throws<InvalidOperationException>(() => MapEndpoints<JsonTranscodingInvalidPatternGreeterService>());
Microsoft.AspNetCore.HeaderParsing.Tests (2)
HeaderParsingExtensionsTests.cs (2)
37Assert.Throws<OptionsValidationException>(() => services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value); 47Assert.Throws<OptionsValidationException>(() => services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value);
Microsoft.AspNetCore.Hosting.Tests (15)
WebHostBuilderTests.cs (9)
69Assert.Throws<ArgumentNullException>(() => builder.UseServer(server).UseStartup((Func<WebHostBuilderContext, object>)null)); 77var ex = Assert.Throws<InvalidOperationException>(() => builder.UseServer(server).UseStartup<object>(context => null).Build()); 424var exception = Assert.Throws<InvalidOperationException>(() => hostBuilder.Build()); 441Assert.Throws<InvalidOperationException>(() => hostBuilder.Build()); 454var exception = Assert.Throws<InvalidOperationException>(() => hostBuilder.Build()); 841var ex = Assert.Throws<InvalidOperationException>(() => builder.Build()); 1005var exception = Assert.Throws<NotSupportedException>(() => builder.Build()); 1260Assert.Throws<ArgumentNullException>(() => new HostingStartupAttribute(null)); 1266Assert.Throws<ArgumentException>(() => new HostingStartupAttribute(typeof(WebHostTests)));
WebHostTests.cs (6)
34Assert.Throws<ArgumentNullException>(() => CreateBuilder().UseStartup((string)null)); 734Assert.Throws<NotImplementedException>(() => builder.Build()); 960Assert.Throws<ObjectDisposedException>(() => capturedContext.TraceIdentifier); 961Assert.Throws<ObjectDisposedException>(() => capturedContext.Features.Get<IHttpRequestIdentifierFeature>()); 963Assert.Throws<ObjectDisposedException>(() => capturedRequest.Scheme); 990var ex = Assert.Throws<InvalidOperationException>(() => builder.Build());
Microsoft.AspNetCore.Http.Abstractions.Tests (28)
EndpointFilterInvocationContextOfTTests.cs (5)
24Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(1)); 25Assert.Throws<InvalidCastException>(() => context.GetArgument<int>(0)); 26Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(3)); 80Assert.Throws<NullReferenceException>(() => context.GetArgument<int>(1)); 81Assert.Throws<NullReferenceException>(() => context.GetArgument<bool>(2));
EndpointMetadataCollectionTests.cs (1)
90Assert.Throws<InvalidOperationException>(() => metadata.GetRequiredMetadata<string>());
HostStringTest.cs (1)
171Assert.Throws<FormatException>(() => HostString.MatchesAny("example.com:1abc", new StringSegment[] { "example.com" }));
HttpProtocolTests.cs (1)
131Assert.Throws<ArgumentOutOfRangeException>(() => HttpProtocol.GetHttpProtocol(version));
MapPathMiddlewareTests.cs (3)
41Assert.Throws<ArgumentNullException>(() => builder.Map("/foo", configuration: null!)); 42Assert.Throws<ArgumentNullException>(() => new MapMiddleware(noMiddleware, null!)); 131Assert.Throws<ArgumentException>(() => new ApplicationBuilder(serviceProvider: null!).Map(matchPath, map => { }).Build());
MapPredicateMiddlewareTests.cs (6)
51Assert.Throws<ArgumentNullException>(() => builder.MapWhen(null!, UseNotImplemented)); 52Assert.Throws<ArgumentNullException>(() => builder.MapWhen(NotImplementedPredicate, configuration: null!)); 53Assert.Throws<ArgumentNullException>(() => new MapWhenMiddleware(null!, noOptions)); 54Assert.Throws<ArgumentNullException>(() => new MapWhenMiddleware(noMiddleware, null!)); 55Assert.Throws<ArgumentNullException>(() => new MapWhenMiddleware(null!, noOptions)); 56Assert.Throws<ArgumentNullException>(() => new MapWhenMiddleware(noMiddleware, null!));
UseMiddlewareTest.cs (11)
16var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareNoParametersStub))); 30var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareAsyncNoParametersStub))); 44var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareNonTaskReturnStub))); 58var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareAsyncNonTaskReturnStub))); 72var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareNoInvokeStub))); 85var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareMultipleInvokesStub))); 98var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAsyncStub))); 111var exception = Assert.Throws<InvalidOperationException>(() => builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAndInvokeAsyncStub))); 153var exception = Assert.Throws<InvalidOperationException>(builder.Build); 208var exception = Assert.Throws<NotSupportedException>(() => builder.Build()); 216var exception = Assert.Throws<NotSupportedException>(() => builder.UseMiddleware(typeof(Middleware), "arg"));
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionManagerTests.cs (2)
38Assert.Throws<ArgumentOutOfRangeException>(() => httpOptions.TransportMaxBufferSize = -1); 39Assert.Throws<ArgumentOutOfRangeException>(() => httpOptions.ApplicationMaxBufferSize = -1);
NegotiateProtocolTests.cs (2)
62var exception = Assert.Throws<InvalidDataException>(() => NegotiateProtocol.ParseResponse(responseData)); 82var exception = Assert.Throws<InvalidDataException>(() => NegotiateProtocol.ParseResponse(responseData));
Microsoft.AspNetCore.Http.Extensions.Tests (46)
HeaderDictionaryTypeExtensionsTest.cs (2)
161Assert.Throws<NotSupportedException>(() => context.Request.GetTypedHeaders().Get<object>("custom")); 285Assert.Throws<NotSupportedException>(() => context.Request.GetTypedHeaders().GetList<object>("custom"));
ProblemDetailsServiceCollectionExtensionsTest.cs (1)
125Assert.Throws<InvalidOperationException>(() => jsonOptions.Value);
RequestDelegateFactoryTests.cs (38)
210var exNullAction = Assert.Throws<ArgumentNullException>(() => RequestDelegateFactory.Create(handler: null!)); 211var exNullMethodInfo1 = Assert.Throws<ArgumentNullException>(() => RequestDelegateFactory.Create(methodInfo: null!)); 729var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 738var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(lambda.Compile())); 906var ex1 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method1)); 907var ex2 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method2)); 908var ex3 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method3)); 932Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestAttributedInvalidAction)); 933Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestInferredInvalidAction)); 934Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBothInvalidAction)); 943Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseStruct)); 944Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseClass)); 966var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncStruct)); 967Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncClass)); 1021var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(@delegate)); 1031Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnType)); 1032Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnArgument)); 1122var outParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(OutMethod)); 1123var inParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(InMethod)); 1124var refParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(RefMethod)); 1412Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction, new() { ServiceProvider = httpContext.RequestServices })); 2003Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJson)); 2004Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFilesAndJson)); 2005Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJsonWithAttribute)); 2006Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileCollectionAndJson)); 2007Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormCollectionAndJson)); 2008Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormWithAttributeAndJson)); 2009Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFile)); 2010Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFiles)); 2011Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileCollection)); 2012Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileWithAttribute)); 2013Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormCollection)); 2014Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormWithAttribute)); 2027var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2076var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2113var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 2126var exception = Assert.Throws<ArgumentException>(() => RequestDelegateFactory.Create(TestAction)); 3232var exception = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(@delegate));
RequestDelegateGenerator\CompileTimeCreationTests.cs (1)
428var exception = Assert.Throws<InvalidOperationException>(() => GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider));
RequestDelegateGenerator\RequestDelegateCreationTests.KeyServices.cs (2)
50var exception = Assert.Throws<NotSupportedException>(() => GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider)); 218var runtimeException = Assert.Throws<InvalidOperationException>(() => GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider));
RequestDelegateGenerator\RuntimeCreationTests.cs (1)
26var ex = Assert.Throws<InvalidOperationException>(() => GetEndpointFromCompilation(compilation));
UriHelperTests.cs (1)
180Assert.Throws<ArgumentNullException>(() => UriHelper.BuildAbsolute(null, resHost, resPath, resPath, resQuery, resFragment));
Microsoft.AspNetCore.Http.Results.Tests (1)
ResultsOfTHelperTests.cs (1)
75Assert.Throws<InvalidOperationException>(() => GetMetadata<DefaultInterfaceMethodEndpointMetadataProvider>());
Microsoft.AspNetCore.Http.Tests (15)
BindingAddressTests.cs (3)
16Assert.Throws<FormatException>(() => BindingAddress.Parse(url)); 30Assert.Throws<FormatException>(() => BindingAddress.Parse(url)); 40Assert.Throws<FormatException>(() => BindingAddress.Parse(url));
DefaultHttpContextTests.cs (1)
23var exception = Assert.Throws<InvalidOperationException>(() => context.Session);
HeaderDictionaryTests.cs (6)
93Assert.Throws<InvalidOperationException>(() => headers["header1"] = "value1"); 94Assert.Throws<InvalidOperationException>(() => ((IDictionary<string, StringValues>)headers)["header1"] = "value1"); 95Assert.Throws<InvalidOperationException>(() => headers.ContentLength = 12); 99Assert.Throws<InvalidOperationException>(() => headers.Remove(new KeyValuePair<string, StringValues>("header1", "value1"))); 100Assert.Throws<InvalidOperationException>(() => headers.Remove("header1")); 133Assert.Throws<KeyNotFoundException>(() => asIDictionary["Header1"]);
Timeouts\RequestTimeoutOptionsTests.cs (5)
49Assert.Throws<ArgumentException>(() => options.AddPolicy("", TimeSpan.FromSeconds(47))); 50Assert.Throws<ArgumentNullException>(() => options.AddPolicy(null, TimeSpan.FromSeconds(47))); 52Assert.Throws<ArgumentException>(() => options.AddPolicy("", new RequestTimeoutPolicy())); 53Assert.Throws<ArgumentNullException>(() => options.AddPolicy(null, new RequestTimeoutPolicy())); 55Assert.Throws<ArgumentNullException>(() => options.AddPolicy("policy1", null));
Microsoft.AspNetCore.HttpLogging.Tests (14)
HttpLoggingAttributeTests.cs (4)
11var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new HttpLoggingAttribute(HttpLoggingFields.None) { RequestBodyLogLimit = -1 }); 14ex = Assert.Throws<ArgumentOutOfRangeException>(() => new HttpLoggingAttribute(HttpLoggingFields.None) { ResponseBodyLogLimit = -1 }); 23Assert.Throws<InvalidOperationException>(() => attribute.RequestBodyLogLimit); 24Assert.Throws<InvalidOperationException>(() => attribute.ResponseBodyLogLimit);
HttpLoggingEndpointConventionBuilderTests.cs (2)
44var ex = Assert.Throws<ArgumentOutOfRangeException>(() => 48ex = Assert.Throws<ArgumentOutOfRangeException>(() =>
HttpLoggingServicesExtensionsTests.cs (4)
14Assert.Throws<ArgumentNullException>(() => 21Assert.Throws<ArgumentNullException>(() => 33var ex = Assert.Throws<InvalidOperationException>(() => appBuilder.UseHttpLogging()); 45var ex = Assert.Throws<InvalidOperationException>(() => appBuilder.UseW3CLogging());
W3CLoggerOptionsTests.cs (4)
21var ex = Assert.Throws<ArgumentOutOfRangeException>(() => options.FileSizeLimit = -1); 29Assert.Throws<ArgumentException>(() => options.FileName = ""); 36Assert.Throws<ArgumentException>(() => options.LogDirectory = ""); 43var ex = Assert.Throws<ArgumentOutOfRangeException>(() => options.FlushInterval = TimeSpan.FromSeconds(-1));
Microsoft.AspNetCore.HttpOverrides.Tests (5)
CertificateForwardingTest.cs (2)
24Assert.Throws<OptionsValidationException>(() => options.Value); 34Assert.Throws<OptionsValidationException>(() => options.Value);
IPNetworkTest.cs (3)
72var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new IPNetwork(address, prefixLength)); 96var ex = Assert.Throws<FormatException>(() => IPNetwork.Parse(input)); 105var ex = Assert.Throws<ArgumentOutOfRangeException>(() => IPNetwork.Parse(input));
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (3)
UserStoreEncryptPersonalDataTest.cs (1)
290var e = Assert.Throws<InvalidOperationException>(() => dbContext.Database.EnsureCreated());
UserStoreWithGenericsTest.cs (2)
83var e = Assert.Throws<InvalidOperationException>(() => builder.AddEntityFrameworkStores<ContextWithGenerics>()); 92var e = Assert.Throws<InvalidOperationException>(() => builder.AddEntityFrameworkStores<ContextWithGenerics>());
Microsoft.AspNetCore.Identity.Test (12)
IdentityBuilderTest.cs (8)
32Assert.Throws<ArgumentException>(() => new IdentityBuilder(typeof(int), new ServiceCollection())); 38Assert.Throws<ArgumentException>(() => new IdentityBuilder(typeof(PocoUser), typeof(int), new ServiceCollection())); 50Assert.Throws<InvalidOperationException>(() => sp.GetService<RoleManager<PocoRole>>()); 256Assert.Throws<InvalidOperationException>(() => builder.AddUserManager<object>()); 257Assert.Throws<InvalidOperationException>(() => builder.AddRoleManager<object>()); 258Assert.Throws<InvalidOperationException>(() => builder.AddSignInManager<object>()); 267Assert.Throws<InvalidOperationException>(() => builder.AddTokenProvider<object>("whatevs")); 268Assert.Throws<InvalidOperationException>(() => builder.AddTokenProvider("whatevs", typeof(object)));
RoleManagerTest.cs (1)
55Assert.Throws<NotSupportedException>(() => manager.Roles.Count());
UserManagerTest.cs (3)
683Assert.Throws<NotSupportedException>(() => manager.Users.Count()); 811var e = Assert.Throws<InvalidOperationException>(() => services.BuildServiceProvider().GetService<UserManager<PocoUser>>()); 822var e = Assert.Throws<InvalidOperationException>(() => services.BuildServiceProvider().GetService<UserManager<PocoUser>>());
Microsoft.AspNetCore.InternalTesting.Tests (7)
MaximumOSVersionAttributeTest.cs (3)
14Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.Linux, "2.5")); 20Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.MacOSX, "2.5")); 26Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, "2.5"));
MinimumOSVersionAttributeTest.cs (3)
14Assert.Throws<NotImplementedException>(() => new MinimumOSVersionAttribute(OperatingSystems.Linux, "2.5")); 20Assert.Throws<NotImplementedException>(() => new MinimumOSVersionAttribute(OperatingSystems.MacOSX, "2.5")); 26Assert.Throws<NotImplementedException>(() => new MinimumOSVersionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, "2.5"));
TestPathUtilitiesTest.cs (1)
18var exception = Assert.Throws<Exception>(() => TestPathUtilities.GetSolutionRootDirectory("NotTesting"));
Microsoft.AspNetCore.Localization.Tests (1)
RequestLocalizationOptionsTest.cs (1)
55Assert.Throws<ArgumentNullException>(() => options.DefaultRequestCulture = null);
Microsoft.AspNetCore.Mvc.Abstractions.Test (9)
ModelBinding\BindingInfoTest.cs (1)
327Assert.Throws<NotSupportedException>(() => BindingInfo.GetBindingInfo(attributes, modelMetadata));
ModelBinding\ModelMetadataTest.cs (6)
387Assert.Throws<NotImplementedException>(() => metadata.ContainerMetadata); 397var result = Assert.Throws<NotImplementedException>(() => metadata.GetMetadataForType(typeof(string))); 407var result = Assert.Throws<NotImplementedException>(() => metadata.GetMetadataForProperties(typeof(string))); 419Assert.Throws<NotSupportedException>(() => metadata.ElementType); 422Assert.Throws<NotSupportedException>(() => metadata.IsComplexType); 423Assert.Throws<NotSupportedException>(() => metadata.IsCollectionType);
ModelBinding\ModelStateDictionaryTest.cs (2)
1652var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.TryAddModelException(key, exception)); 1670var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.TryAddModelError(key, "errorMessage"));
Microsoft.AspNetCore.Mvc.Core.Test (40)
ActionResultOfTTest.cs (3)
18var ex = Assert.Throws<ArgumentException>(() => new ActionResult<FileStreamResult>(value: input)); 29var ex = Assert.Throws<ArgumentException>(() => new ActionResult<FileStreamResult>(result: actionResult)); 40var ex = Assert.Throws<ArgumentException>(() => new ActionResult<TestResult>(value: result));
ApplicationParts\RelatedAssemblyPartTest.cs (2)
36var ex = Assert.Throws<InvalidOperationException>(() => RelatedAssemblyAttribute.GetRelatedAssemblies(assembly, throwOnError: true)); 51Assert.Throws<FileNotFoundException>(() => RelatedAssemblyAttribute.GetRelatedAssemblies(assembly, throwOnError: true));
Builder\MvcApplicationBuilderExtensionsTest.cs (1)
24var exception = Assert.Throws<InvalidOperationException>(
ConsumesAttributeTests.cs (3)
28var exception = Assert.Throws<FormatException>(() => new ConsumesAttribute(contentType)); 45var ex = Assert.Throws<FormatException>( 65var ex = Assert.Throws<InvalidOperationException>(
Controllers\ServiceBasedControllerActivatorTest.cs (1)
66var ex = Assert.Throws<InvalidOperationException>(
Formatters\InputFormatterTest.cs (2)
393Assert.Throws<InvalidOperationException>(() => formatter.CanRead(context)); 403Assert.Throws<InvalidOperationException>(
Formatters\MediaTypeTest.cs (1)
131Assert.Throws<ArgumentException>(() => new MediaType("lengthof9", 5, 5));
Formatters\OutputFormatterTests.cs (2)
216Assert.Throws<InvalidOperationException>(() => formatter.CanWriteResult(context)); 227Assert.Throws<InvalidOperationException>(
Formatters\TextInputFormatterTest.cs (1)
57Assert.Throws<InvalidOperationException>(() => formatter.TestSelectCharacterEncoding(context));
ModelBinding\Binders\BodyModelBinderProviderTest.cs (1)
52var exception = Assert.Throws<InvalidOperationException>(() => provider.GetBinder(context));
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (3)
539var exception = Assert.Throws<InvalidOperationException>(() => binder.CreateModelPublic(bindingContext)); 564var exception = Assert.Throws<InvalidOperationException>(() => binder.CreateModelPublic(bindingContext)); 581var exception = Assert.Throws<InvalidOperationException>(() => binder.CreateModelPublic(bindingContext));
ModelBinding\Binders\FormCollectionModelBinderProviderTest.cs (1)
20var exception = Assert.Throws<InvalidOperationException>(() => provider.GetBinder(context));
ModelBinding\Metadata\ModelAttributesTest.cs (1)
298var exception = Assert.Throws<InvalidOperationException>(() => ModelAttributes.GetAttributesForProperty(modelType, property));
ModelBinding\ModelBinderFactoryTest.cs (2)
34var exception = Assert.Throws<InvalidOperationException>(() => factory.CreateBinder(context)); 56var exception = Assert.Throws<InvalidOperationException>(() => factory.CreateBinder(context));
ModelBinding\Validation\DefaultComplexObjectValidationStrategyTest.cs (3)
150Assert.Throws<NullReferenceException>(() => entry.Model); 156Assert.Throws<NullReferenceException>(() => entry.Model); 182var exception = Assert.Throws<InvalidOperationException>(() => BufferEntries(enumerator));
MvcOptionsTest.cs (1)
15var ex = Assert.Throws<ArgumentOutOfRangeException>(() => options.MaxModelValidationErrors = -1);
ProducesAttributeTests.cs (2)
100var ex = Assert.Throws<FormatException>( 122var ex = Assert.Throws<InvalidOperationException>(
ProducesResponseTypeAttributeTests.cs (1)
41var ex = Assert.Throws<InvalidOperationException>(
ResponseCacheAttributeTest.cs (1)
54var ex = Assert.Throws<InvalidOperationException>(
Routing\ActionEndpointFactoryTest.cs (1)
213var exception = Assert.Throws<InvalidOperationException>(() => CreateAttributeRoutedEndpoint(action));
Routing\ControllerLinkGeneratorExtensionsTest.cs (4)
25var exception = Assert.Throws<ArgumentException>(() => 29exception = Assert.Throws<ArgumentNullException>(() => 33exception = Assert.Throws<ArgumentNullException>(() => 37exception = Assert.Throws<ArgumentNullException>(() =>
Routing\KnownRouteValueConstraintTests.cs (1)
191var ex = Assert.Throws<InvalidOperationException>(
Routing\UrlHelperExtensionsTest.cs (1)
549var ex = Assert.Throws<InvalidOperationException>(() => urlHelper.Object.Page(expected));
Routing\UrlHelperTestBase.cs (1)
1088var ex = Assert.Throws<InvalidOperationException>(() => urlHelper.ActionLink("contact", "home"));
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerInputFormatterTest.cs (1)
452Assert.Throws<ArgumentOutOfRangeException>(() => formatter.MaxDepth = 0);
XmlSerializerInputFormatterTest.cs (1)
469Assert.Throws<ArgumentOutOfRangeException>(() => formatter.MaxDepth = 0);
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
AntiforgeryMiddlewareTest.cs (1)
63var exception = Assert.Throws<InvalidOperationException>(() => app.MapControllers());
SimpleWithWebApplicationBuilderExceptionTests.cs (1)
29var ex = Assert.Throws<InvalidOperationException>(() => Factory.CreateClient());
TestingInfrastructureTests.cs (1)
47var ex = Assert.Throws<InvalidOperationException>(() => factory.CreateClient());
Microsoft.AspNetCore.Mvc.IntegrationTests (6)
ValidationIntegrationTests.cs (3)
1489Assert.Throws<NullReferenceException>(() => model.ValidateNeverLength); 1596Assert.Throws<NullReferenceException>(() => model.ControlLength); 1686Assert.Throws<NullReferenceException>(() => model.ControlLength);
ValidationWithRecordIntegrationTests.cs (3)
1333Assert.Throws<NullReferenceException>(() => model.ValidateNeverLength); 1404Assert.Throws<NullReferenceException>(() => model.ControlLength); 1492Assert.Throws<NullReferenceException>(() => model.ControlLength);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
DependencyInjection\MvcNewtonsoftJsonOptionsExtensionsTest.cs (2)
221var exception = Assert.Throws<InvalidOperationException>( 235var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.Mvc.Razor.Test (1)
RazorPageTest.cs (1)
444ex = Assert.Throws<InvalidOperationException>(() => v.RenderSection("bar"));
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Infrastructure\ServiceBasedPageModelActivatorProviderTest.cs (1)
115var ex = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (34)
AttributeDictionaryTest.cs (1)
387Assert.Throws<KeyNotFoundException>(() => attributes["nada"]);
ControllerUnitTestabilityTests.cs (1)
557Assert.Throws<ArgumentNullException>(() => controller.Redirect_Action(null));
DefaultDisplayTemplatesTest.cs (1)
366var ex = Assert.Throws<ArgumentException>(() => helper.DisplayFor(m => m.Property1));
DefaultEditorTemplatesTest.cs (1)
1314var ex = Assert.Throws<FormatException>(() => helper.EditorFor(m => m.Property1));
DefaultHtmlGeneratorTest.cs (1)
525var exception = Assert.Throws<InvalidOperationException>(() => htmlGenerator.GetCurrentValues(
Infrastructure\DefaultTempDataSerializerTest.cs (1)
51var ex = Assert.Throws<InvalidOperationException>(() => testProvider.Serialize(input));
RemoteAttributeTest.cs (1)
149var exception = Assert.Throws<InvalidOperationException>(() => testableAttribute.InvokeGetUrl(context));
Rendering\HtmlHelperCheckboxTest.cs (1)
81var ex = Assert.Throws<FormatException>(
Rendering\HtmlHelperDisplayNameExtensionsTest.cs (2)
166var exception = Assert.Throws<InvalidOperationException>( 181var exception = Assert.Throws<InvalidOperationException>(
Rendering\HtmlHelperLabelExtensionsTest.cs (1)
429var exception = Assert.Throws<InvalidOperationException>(
Rendering\HtmlHelperPartialExtensionsTest.cs (1)
85var actual = Assert.Throws<InvalidOperationException>(() => partialMethod(helper.Object));
ViewComponents\DefaultViewComponentDescriptorProviderTest.cs (5)
22var ex = Assert.Throws<InvalidOperationException>(() => provider.GetViewComponents().ToArray()); 38var ex = Assert.Throws<InvalidOperationException>(() => provider.GetViewComponents().ToArray()); 53var ex = Assert.Throws<InvalidOperationException>(() => provider.GetViewComponents().ToArray()); 67var ex = Assert.Throws<InvalidOperationException>(() => provider.GetViewComponents().ToArray()); 80var ex = Assert.Throws<InvalidOperationException>(() => provider.GetViewComponents().ToArray());
ViewComponents\DefaultViewComponentSelectorTest.cs (2)
104var ex = Assert.Throws<InvalidOperationException>(() => selector.SelectComponent("Ambiguous")); 125var ex = Assert.Throws<InvalidOperationException>(() => selector.SelectComponent(name));
ViewDataDictionaryOfTModelTest.cs (10)
216var exception = Assert.Throws<InvalidOperationException>(() => new ViewDataDictionary<string>(source)); 219exception = Assert.Throws<InvalidOperationException>(() => new ViewDataDictionary<string>(source, model: 24)); 385var exception = Assert.Throws<InvalidOperationException>(() => viewData1.Model = 23); 388exception = Assert.Throws<InvalidOperationException>(() => viewData2.Model = 24); 391exception = Assert.Throws<InvalidOperationException>(() => viewData3.Model = 25); 395exception = Assert.Throws<InvalidOperationException>(() => viewData4.Model = 26); 412var exception = Assert.Throws<InvalidOperationException>(() => viewData1.Model = null); 415exception = Assert.Throws<InvalidOperationException>(() => viewData2.Model = null); 418exception = Assert.Throws<InvalidOperationException>(() => viewData3.Model = null); 422exception = Assert.Throws<InvalidOperationException>(() => viewData4.Model = null);
ViewDataOfTTest.cs (2)
18Exception ex = Assert.Throws<InvalidOperationException>(() => viewData.Model = null); 30Exception ex = Assert.Throws<InvalidOperationException>(() => viewData.Model = DateTime.UtcNow);
ViewEngines\CompositeViewEngineTest.cs (3)
44var exception = Assert.Throws<InvalidOperationException>( 172var exception = Assert.Throws<InvalidOperationException>( 311var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiGeneratorTests.cs (1)
77var ex = Assert.Throws<InvalidOperationException>(() => GetOpenApiOperation(lambda.Compile()));
Microsoft.AspNetCore.Owin.Tests (1)
OwinEnvironmentTests.cs (1)
108Assert.Throws<KeyNotFoundException>(() => env[key]);
Microsoft.AspNetCore.RateLimiting.Tests (8)
RateLimitingApplicationBuilderExtensionsTests.cs (3)
16Assert.Throws<ArgumentNullException>(() => RateLimiterApplicationBuilderExtensions.UseRateLimiter(null)); 23Assert.Throws<ArgumentNullException>(() => appBuilder.UseRateLimiter(null)); 34var ex = Assert.Throws<InvalidOperationException>(() => appBuilder.UseRateLimiter());
RateLimitingOptionsTests.cs (5)
16Assert.Throws<ArgumentNullException>(() => options.AddPolicy<string>(null, context => RateLimitPartition.GetNoLimiter<string>("myKey"))); 23Assert.Throws<ArgumentNullException>(() => options.AddPolicy<string>("myKey", partitioner: null)); 30Assert.Throws<ArgumentNullException>(() => options.AddPolicy<string>("myKey", policy: null)); 38Assert.Throws<ArgumentException>(() => options.AddPolicy<string>("myKey", context => RateLimitPartition.GetNoLimiter<string>("yourKey"))); 46Assert.Throws<ArgumentException>(() => options.AddPolicy<string, TestRateLimiterPolicy>("myKey"));
Microsoft.AspNetCore.ResponseCaching.Tests (1)
ResponseCachingFeatureTests.cs (1)
52Assert.Throws<ArgumentException>(() => new ResponseCachingFeature().VaryByQueryKeys = value);
Microsoft.AspNetCore.Routing.FunctionalTests (1)
MinimalFormTests.cs (1)
228exception = Assert.Throws<InvalidOperationException>(() => app.UseAntiforgery());
Microsoft.AspNetCore.Routing.Tests (44)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (4)
28var ex = Assert.Throws<InvalidOperationException>(() => app.UseRouting()); 45var ex = Assert.Throws<InvalidOperationException>(() => app.UseEndpoints(endpoints => { })); 118var ex = Assert.Throws<InvalidOperationException>(() => app.UseEndpoints(endpoints => { })); 140var ex = Assert.Throws<InvalidOperationException>(() => app.Map("/Test", b => b.UseEndpoints(endpoints => { })));
Builder\GroupTest.cs (1)
309var ex = Assert.Throws<NotSupportedException>(() => dataSource.Endpoints);
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
469Assert.Throws<InvalidOperationException>(() => endpointBuilder.WithMetadata(new RouteNameMetadata("Foo")));
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (6)
216var ex = Assert.Throws<InvalidOperationException>(() => dataSource.Endpoints); 227var ex = Assert.Throws<InvalidOperationException>(() => dataSource.Endpoints); 255var ex = Assert.Throws<InvalidOperationException>(() => dataSource.Endpoints); 499Assert.Throws<InvalidOperationException>(() => endpointBuilder.WithMetadata(new RouteNameMetadata("Foo"))); 596var ex = Assert.Throws<InvalidOperationException>(() => dataSource.Endpoints); 654var ex = Assert.Throws<InvalidOperationException>(() => dataSource.Endpoints);
Builder\RoutingBuilderExtensionsTest.cs (3)
25var exception = Assert.Throws<InvalidOperationException>( 42var ex = Assert.Throws<InvalidOperationException>(() => app.UseRouter(Mock.Of<IRouter>())); 59var ex = Assert.Throws<InvalidOperationException>(() => app.UseRouter(b => { }));
CompositeEndpointDataSourceTest.cs (4)
77Assert.Same(ex, Assert.Throws<Exception>(() => compositeDataSource.Endpoints)); 78Assert.Same(ex, Assert.Throws<Exception>(() => compositeDataSource.Endpoints)); 79Assert.Same(ex, Assert.Throws<Exception>(() => compositeDataSource.GetGroupedEndpoints(groupContext))); 80Assert.Same(ex, Assert.Throws<Exception>(() => compositeDataSource.GetGroupedEndpoints(groupContext)));
DefaultEndpointDataSourceTests.cs (2)
49var actual = Assert.Throws<ArgumentNullException>(() => new DefaultEndpointDataSource(endpoints)); 93var actual = Assert.Throws<ArgumentNullException>(() => new DefaultEndpointDataSource(endpoints));
DefaultInlineConstraintResolverTest.cs (4)
48var ex = Assert.Throws<RouteCreationException>( 319var ex = Assert.Throws<RouteCreationException>(() => resolver.ResolveConstraint("custom")); 334var ex = Assert.Throws<RouteCreationException>(() => resolver.ResolveConstraint("custom(5,6)")); 360var ex = Assert.Throws<RouteCreationException>(() => _constraintResolver.ResolveConstraint("int(5,6)"));
DefaultParameterPolicyFactoryTest.cs (4)
21var exception = Assert.Throws<InvalidOperationException>( 43var exception = Assert.Throws<RouteCreationException>( 331var exception = Assert.Throws<RouteCreationException>( 372var exception = Assert.Throws<RouteCreationException>(
Patterns\RoutePatternFactoryTest.cs (8)
76var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Pattern( 124var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Pattern( 390var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Pattern( 757var ex = Assert.Throws<RoutePatternException>(() => RoutePatternFactory.Combine(left, right)); 805var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Combine(left, right)); 817var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Combine(left, right)); 830var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Combine(left, right)); 842var ex = Assert.Throws<InvalidOperationException>(() => RoutePatternFactory.Combine(left, right));
RouteBuilderTest.cs (1)
43var exception = Assert.Throws<InvalidOperationException>(() => new RouteBuilder(applicationBuilderMock.Object));
RouteCollectionTest.cs (2)
303var ex = Assert.Throws<InvalidOperationException>(() => routeCollection.GetVirtualPath(virtualPathContext)); 325var ex = Assert.Throws<InvalidOperationException>(() => routeCollection.GetVirtualPath(virtualPathContext));
RouteEndpointBuilderTest.cs (1)
23var ex = Assert.Throws<ArgumentNullException>(() => new RouteEndpointBuilder(context => Task.CompletedTask, routePattern: null, order: 0));
RouteTest.cs (1)
31var exception = Assert.Throws<RouteCreationException>(
TemplateParserDefaultValuesTests.cs (2)
60var ex = Assert.Throws<RouteCreationException>( 85var ex = Assert.Throws<RouteCreationException>(
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (12)
OpaqueUpgradeTests.cs (1)
146Assert.Throws<InvalidOperationException>(() => feature.MaxRequestBodySize = 12);
RequestBodyLimitTests.cs (9)
165var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length)); 168ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length)); 215var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null)); 218ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null)); 241var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length)); 244ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length)); 291var ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null))); 294ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null))); 321var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
ResponseHeaderTests.cs (2)
228Assert.Throws<InvalidOperationException>(() => response.StatusCode = 404); 259Assert.Throws<InvalidOperationException>(() => response.StatusCode = 404);
Microsoft.AspNetCore.Server.HttpSys.Tests (4)
UrlPrefixTests.cs (4)
18Assert.Throws<FormatException>(() => UrlPrefix.Create(url)); 27Assert.Throws<ArgumentOutOfRangeException>(() => UrlPrefix.Create(url)); 39Assert.Throws<ArgumentException>(() => UrlPrefix.Create(url)); 49Assert.Throws<FormatException>(() => UrlPrefix.Create(url));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (73)
BodyControlTests.cs (3)
101Assert.Throws<Exception>(() => requestPipe.TryRead(out var res))); 118Assert.Throws<ObjectDisposedException>(() => requestPipe.TryRead(out var res)); 134Assert.Throws<ObjectDisposedException>(() => responsePipe.GetMemory());
DiagnosticMemoryPoolTests.cs (8)
56var exception = Assert.Throws<InvalidOperationException>(() => block.Memory); 69var exception = Assert.Throws<InvalidOperationException>(() => memory.Pin()); 104var exception = Assert.Throws<InvalidOperationException>(() => MemoryMarshal.TryGetArray<byte>(memory, out _)); 116var exception = Assert.Throws<ObjectDisposedException>(() => block.Memory); 131var exception = Assert.Throws<ObjectDisposedException>(() => memory.Pin()); 170var exception = Assert.Throws<ObjectDisposedException>(() => MemoryMarshal.TryGetArray<byte>(memory, out _)); 193var exception = Assert.Throws<InvalidOperationException>(() => block.Memory); 210var exception = Assert.Throws<InvalidOperationException>(() => block.Memory);
Http1\Http1ConnectionTests.cs (6)
56var exception = Assert.Throws<InvalidOperationException>(() => TakeMessageHeaders(readableBuffer, trailers: false, out _consumed, out _examined)); 304Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)_http1Connection).StatusCode = StatusCodes.Status404NotFound); 315Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)_http1Connection).ReasonPhrase = "Reason phrase"); 560var exception = Assert.Throws<BadHttpRequestException>(() => 940var ex = Assert.Throws<InvalidOperationException>(() => ((IHttpMaxRequestBodySizeFeature)_http1Connection).MaxRequestBodySize = 1); 948var ex = Assert.Throws<ArgumentOutOfRangeException>(() => ((IHttpMaxRequestBodySizeFeature)_http1Connection).MaxRequestBodySize = -1);
Http2\Http2HttpProtocolFeatureCollectionTests.cs (3)
54Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate); 55Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate = new MinDataRate(1, TimeSpan.FromSeconds(2))); 61Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate);
Http3\Http3HttpProtocolFeatureCollectionTests.cs (3)
54Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate); 55Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate = new MinDataRate(1, TimeSpan.FromSeconds(2))); 61Assert.Throws<NotSupportedException>(() => minRateFeature.MinDataRate);
HttpParserTests.cs (7)
86var exception = Assert.Throws<BadHttpRequestException>(() => 120var exception = Assert.Throws<BadHttpRequestException>(() => 139var exception = Assert.Throws<BadHttpRequestException>(() => 167var exception = Assert.Throws<BadHttpRequestException>(() => 185var exception = Assert.Throws<BadHttpRequestException>(() => 528var exception = Assert.Throws<BadHttpRequestException>(() => 539exception = Assert.Throws<BadHttpRequestException>(() =>
HttpRequestHeadersTests.cs (3)
97Assert.Throws<KeyNotFoundException>(() => headers["custom"]); 98Assert.Throws<KeyNotFoundException>(() => headers["host"]); 99Assert.Throws<KeyNotFoundException>(() => headers["Content-Length"]);
HttpRequestStreamTests.cs (5)
43Assert.Throws<NotSupportedException>(() => stream.Seek(0, SeekOrigin.Begin)); 50Assert.Throws<NotSupportedException>(() => stream.Length); 64Assert.Throws<NotSupportedException>(() => stream.Position); 65Assert.Throws<NotSupportedException>(() => stream.Position = 0); 120var ioEx = Assert.Throws<InvalidOperationException>(() => stream.Read(new byte[1], 0, 1));
HttpResponseHeadersTests.cs (2)
287Assert.Throws<InvalidOperationException>(() => dictionary["my-header"] = "other-value"); 298Assert.Throws<InvalidOperationException>(() => dictionary.Remove("my-header"));
HttpResponseStreamTests.cs (7)
43Assert.Throws<NotSupportedException>(() => stream.Read(new byte[1], 0, 1)); 50Assert.Throws<NotSupportedException>(() => stream.ReadByte()); 64Assert.Throws<NotSupportedException>(() => stream.BeginRead(new byte[1], 0, 1, null, null)); 71Assert.Throws<NotSupportedException>(() => stream.Seek(0, SeekOrigin.Begin)); 78Assert.Throws<NotSupportedException>(() => stream.Length); 92Assert.Throws<NotSupportedException>(() => stream.Position); 93Assert.Throws<NotSupportedException>(() => stream.Position = 0);
KestrelServerLimitsTests.cs (9)
108var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().MaxRequestHeadersTotalSize = value); 173var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits { KeepAliveTimeout = value }); 202var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits { RequestHeadersTimeout = value }); 235var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().MaxConcurrentConnections = value); 259var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().MaxConcurrentUpgradedConnections = value); 290var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().MaxRequestBodySize = value); 322var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().Http2.MaxFrameSize = value); 337var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().Http2.HeaderTableSize = value); 353var ex = Assert.Throws<ArgumentOutOfRangeException>(() => new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize = value);
KestrelServerOptionsTests.cs (3)
63Assert.Throws<InvalidOperationException>(() => options.Configure()); 74Assert.Throws<InvalidOperationException>(() => options.Configure()); 102var ex = Assert.Throws<ArgumentNullException>(() => options.RequestHeaderEncodingSelector = null);
KestrelServerTests.cs (1)
281var exception = Assert.Throws<ArgumentNullException>(() =>
MemoryPoolTests.cs (1)
46var exception = Assert.Throws<ObjectDisposedException>(() => memoryPool.Rent());
MessageBodyTests.cs (10)
146Assert.Throws<InvalidOperationException>(() => reader.TryRead(out readResult)); 1203Assert.Throws<InvalidOperationException>(() => reader.TryRead(out readResult)); 1221var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1222var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1254var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1255var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1281var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1282var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1340Assert.Throws<InvalidOperationException>(() => reader.TryRead(out readResult)); 1366Assert.Throws<InvalidOperationException>(() => reader.TryRead(out readResult));
MinDataRateTests.cs (2)
26var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new MinDataRate(bytesPerSecond: value, gracePeriod: TimeSpan.MaxValue)); 43var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new MinDataRate(bytesPerSecond: 1, gracePeriod: value));
Microsoft.AspNetCore.Server.Kestrel.Tests (2)
ConfigurationReaderTests.cs (1)
97var exception = Assert.Throws<ArgumentException>(() =>
HttpsConnectionAdapterOptionsTest.cs (1)
37var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new HttpsConnectionAdapterOptions { HandshakeTimeout = value });
Microsoft.AspNetCore.Shared.Tests (39)
CommandLineApplicationTests.cs (18)
70var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test", "one", "two", "three")); 111var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test2", "one", "two", "three")); 163var ex = Assert.Throws<InvalidOperationException>(() => app.Argument("second", "Second argument")); 203var ex = Assert.Throws<CommandParsingException>(() => app.Execute("test", "--first")); 261var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedArg)); 433var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption)); 643var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption)); 676var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", unexpectedOption)); 711var exception = Assert.Throws<CommandParsingException>(() => app.Execute("k", unexpectedOption, "run")); 814Assert.Throws<CommandParsingException>(() => app.Execute("subcmd", "-b", "B")); 829Assert.Throws<InvalidOperationException>(() => app.Execute("subcmd", "-a", "b")); 891Assert.Throws<CommandParsingException>(() => app.Execute("--nest2", "N2", "--nest1", "N1", "-g", "G")); 892Assert.Throws<CommandParsingException>(() => app.Execute("lvl1", "--nest2", "N2", "--nest1", "N1", "-g", "G")); 1117var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOptions)); 1143var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption)); 1154var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption)); 1165var exception = Assert.Throws<CommandParsingException>(() => app.Execute(inputOption)); 1219var exception = Assert.Throws<CommandParsingException>(() => app.Execute("test", firstOption));
ObjectMethodExecutorTest.cs (3)
74Assert.Throws<NotImplementedException>( 152Assert.Throws<ArgumentOutOfRangeException>(() => executor.GetDefaultValueForParameter(2)); 159Assert.Throws<InvalidOperationException>(() => executor.GetDefaultValueForParameter(0));
PropertyHelperTest.cs (2)
496Assert.Throws<NullReferenceException>(() => accessor(null)); 510Assert.Throws<NullReferenceException>(() => accessor(null));
runtime\Http2\DynamicTableTest.cs (2)
67Assert.Throws<IndexOutOfRangeException>(() => dynamicTable[0]); 70Assert.Throws<IndexOutOfRangeException>(() => dynamicTable[1]);
runtime\Http2\HPackIntegerTest.cs (1)
103Assert.Throws<HPackDecodingException>(() => decoder.TryDecode(octets[octets.Length - 1], out intResult));
runtime\Http2\HuffmanDecodingTests.cs (4)
89Assert.Throws<HuffmanDecodingException>(() => Huffman.Decode(encoded, ref decoded)); 271Exception exception = Assert.Throws<HuffmanDecodingException>(() => Huffman.Decode(new ReadOnlySpan<byte>(encoded), ref dst)); 288Exception exception = Assert.Throws<HuffmanDecodingException>(() => Huffman.Decode(new ReadOnlySpan<byte>(encoded), ref dst)); 333Exception exception = Assert.Throws<HuffmanDecodingException>(() => Huffman.Decode(new ReadOnlySpan<byte>(encoded), ref dst));
SegmentWriteStreamTests.cs (4)
18Assert.Throws<ArgumentOutOfRangeException>(() => new SegmentWriteStream(segmentSize)); 26Assert.Throws<NotSupportedException>(() => stream.Read(new byte[1], 0, 0)); 27Assert.Throws<NotSupportedException>(() => stream.Position = 0); 28Assert.Throws<NotSupportedException>(() => stream.Seek(0, SeekOrigin.Begin));
UrlDecoderTests.cs (4)
57Assert.Throws<ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1))); 64Assert.Throws<ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1), false)); 87Assert.Throws<InvalidOperationException>(() => UrlDecoder.DecodeInPlace(source.AsSpan())); 94Assert.Throws<InvalidOperationException>(() => UrlDecoder.DecodeInPlace(source.AsSpan(), false));
ValueStopwatchTest.cs (1)
28Assert.Throws<InvalidOperationException>(() => stopwatch.GetElapsedTime());
Microsoft.AspNetCore.SignalR.Client.Tests (10)
HttpConnectionTests.cs (6)
45Assert.Throws<ArgumentOutOfRangeException>(() => httpOptions.TransportMaxBufferSize = -1); 46Assert.Throws<ArgumentOutOfRangeException>(() => httpOptions.ApplicationMaxBufferSize = -1); 52var exception = Assert.Throws<ArgumentNullException>(() => new HttpConnection(null)); 59var exception = Assert.Throws<ArgumentException>(() => new HttpConnection(new HttpConnectionOptions(), NullLoggerFactory.Instance)); 67var exception = Assert.Throws<InvalidOperationException>(() => connection.ConnectionId = "custom conneciton ID"); 122Assert.Throws<ArgumentNullException>(() => httpOptions.Cookies = null);
HubConnectionBuilderTests.cs (3)
22var ex = Assert.Throws<InvalidOperationException>(() => new HubConnectionBuilder().Build()); 32var ex = Assert.Throws<InvalidOperationException>(() => builder.Build()); 69var ex = Assert.Throws<InvalidOperationException>(() => builder.Build());
HubConnectionTests.Protocol.cs (1)
712var ex = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.SignalR.Common.Tests (6)
Internal\Protocol\HandshakeProtocolTests.cs (1)
107var exception = Assert.Throws<InvalidDataException>(() =>
Internal\Protocol\JsonHubProtocolTests.cs (1)
54var ex = Assert.Throws<InvalidDataException>(() => JsonHubProtocol.TryParseMessage(ref data, binder, out var _));
Internal\Protocol\JsonHubProtocolTestsBase.cs (2)
196var ex = Assert.Throws<InvalidDataException>(() => JsonHubProtocol.TryParseMessage(ref data, binder, out var _)); 269var ex = Assert.Throws<InvalidDataException>(() => JsonHubProtocol.TryParseMessage(ref data, binder, out var message));
Internal\Protocol\MessagePackHubProtocolTestBase.cs (1)
364var exception = Assert.Throws<InvalidDataException>(() => HubProtocol.TryParseMessage(ref data, binder, out _));
Internal\Protocol\NewtonsoftJsonHubProtocolTests.cs (1)
52var ex = Assert.Throws<InvalidDataException>(() => JsonHubProtocol.TryParseMessage(ref data, binder, out var _));
Microsoft.AspNetCore.SignalR.Tests (6)
AddSignalRTests.cs (1)
196Assert.Throws<ArgumentOutOfRangeException>(() => new HubOptions() { MaximumParallelInvocationsPerClient = 0 });
HubConnectionHandlerTests.cs (5)
243var ex = Assert.Throws<InvalidOperationException>(() => 1361var exception = Assert.Throws<NotSupportedException>(() => serviceProvider.GetService<HubConnectionHandler<GenericMethodHub>>()); 5046var ex = Assert.Throws<InvalidOperationException>(() => serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>()); 5062var ex = Assert.Throws<InvalidOperationException>(() => serviceProvider.GetService<HubConnectionHandler<BadServicesHub>>()); 5073Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.TestHost.Tests (4)
ClientHandlerTests.cs (1)
344Assert.Throws<NotSupportedException>(() => invoker.Send(message, CancellationToken.None));
HttpContextBuilderTests.cs (1)
300var ex = Assert.Throws<IOException>(() => context.Response.Body.Read(new byte[100], 0, 100));
TestServerTests.cs (2)
118Assert.Throws<InvalidOperationException>(() => new TestServer(builder)); 306Assert.Throws<ArgumentNullException>(() => new TestServer(builder, null));
Microsoft.AspNetCore.Tests (34)
WebApplicationTests.cs (34)
282Assert.Throws<InvalidOperationException>(() => app.Urls); 373Assert.Throws<NotSupportedException>(() => ((IHostBuilder)createBuilder().Host).Build()); 380Assert.Throws<NotSupportedException>(() => ((IWebHostBuilder)createBuilder().WebHost).Build()); 393Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.ApplicationKey, nameof(WebApplicationTests))); 394Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.EnvironmentKey, envName)); 395Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.ContentRootKey, contentRoot)); 396Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.WebRootKey, webRoot)); 397Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.HostingStartupAssembliesKey, "hosting")); 398Assert.Throws<NotSupportedException>(() => builder.WebHost.UseSetting(WebHostDefaults.HostingStartupExcludeAssembliesKey, "hostingexclude")); 399Assert.Throws<NotSupportedException>(() => builder.WebHost.UseEnvironment(envName)); 400Assert.Throws<NotSupportedException>(() => builder.WebHost.UseContentRoot(contentRoot)); 413Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 421Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 429Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 437Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 445Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 453Assert.Throws<NotSupportedException>(() => builder.WebHost.ConfigureAppConfiguration(builder => 1080Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureHostConfiguration(builder => 1088Assert.Throws<NotSupportedException>(() => builder.Host.UseEnvironment(envName)); 1089Assert.Throws<NotSupportedException>(() => builder.Host.UseContentRoot(contentRoot)); 1620var ex = Assert.Throws<InvalidOperationException>(() => app.UseEndpoints(endpoints => { })); 1817Assert.Throws<InvalidOperationException>(() => builder.Services.AddSingleton<IService>(new Service())); 1819Assert.Throws<InvalidOperationException>(() => builder.Services.AddScoped<IService, Service>()); 1821Assert.Throws<InvalidOperationException>(() => builder.Services.Remove(ServiceDescriptor.Singleton(new Service()))); 1822Assert.Throws<InvalidOperationException>(() => builder.Services[0] = ServiceDescriptor.Singleton(new Service())); 1831var ex = Assert.Throws<NotSupportedException>(() => builder.WebHost.Configure(app => { })); 1832var ex1 = Assert.Throws<NotSupportedException>(() => builder.WebHost.Configure((context, app) => { })); 1833var ex2 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup<MyStartup>()); 1834var ex3 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup(typeof(MyStartup))); 1835var ex4 = Assert.Throws<NotSupportedException>(() => builder.WebHost.UseStartup(context => new MyStartup())); 1843var ex5 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHost(webHostBuilder => { })); 1844var ex6 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHost(webHostBuilder => { }, options => { })); 1845var ex7 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureSlimWebHost(webHostBuilder => { }, options => { })); 1846var ex8 = Assert.Throws<NotSupportedException>(() => builder.Host.ConfigureWebHostDefaults(webHostBuilder => { }));
Microsoft.AspNetCore.WebSockets.Tests (1)
AddWebSocketsTests.cs (1)
36Assert.Throws<ArgumentOutOfRangeException>(() => new WebSocketOptions() { KeepAliveTimeout = TimeSpan.FromMicroseconds(-1) });
Microsoft.AspNetCore.WebUtilities.Tests (2)
FileBufferingReadStreamTests.cs (2)
159var exception = Assert.Throws<IOException>(() => stream.Read(bytes, 0, bytes.Length)); 191var exception = Assert.Throws<IOException>(() => stream.Read(bytes, 0, bytes.Length));
Microsoft.Build.Engine.UnitTests (24)
BackEnd\ConfigCache_Tests.cs (1)
125Assert.Throws<InternalErrorException>(() => ((ConfigCache)obj).GetSmallestConfigId());
BackEnd\TargetBuilder_Tests.cs (1)
1467Assert.Throws<InternalErrorException>(() => resultsCache.GetResultForRequest(entry.Request));
BuildEventArgsSerialization_Tests.cs (1)
961Assert.Throws<EndOfStreamException>(() => buildEventArgsReader.Read());
Evaluation\Evaluator_Tests.cs (1)
66Assert.Throws<InvalidProjectFileException>(() => collection.LoadProject(projectFile.Path));
Evaluation\Expander_Tests.cs (8)
2655Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Microsoft.FOO.FileIO.FileSystem]::CurrentDirectory)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2656Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.Baz]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2657Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2658Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([Foo.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2659Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.Foo]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2660Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([.]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 2661Assert.Throws<InvalidProjectFileException>(() => expander.ExpandIntoStringLeaveEscaped("$([]::new())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); 3345var ex = Assert.Throws<InvalidProjectFileException>(
Evaluation\ImportFromMSBuildExtensionsPath_Tests.cs (5)
60Assert.Throws<InvalidProjectFileException>(() => projColln.LoadProject(mainProjectPath)); 310Assert.Throws<InvalidProjectFileException>(() => projColln.LoadProject(mainProjectPath)); 643Assert.Throws<InvalidProjectFileException>(() => projectCollection.LoadProject(mainProjectPath)); 837Assert.Throws<InvalidProjectFileException>(() => projectCollection.LoadProject(mainProjectPath)); 871Assert.Throws<InvalidProjectFileException>(() => projectCollection.LoadProject(mainProjectPath));
Evaluation\ProjectSdkImplicitImport_Tests.cs (2)
328Assert.Throws<InvalidProjectFileException>( 396Assert.Throws<InvalidProjectFileException>(() => new Project(
Globbing\MSBuildGlob_Tests.cs (4)
57Assert.Throws<ArgumentNullException>(() => MSBuildGlob.Parse(null, "*")); 75Assert.Throws<ArgumentException>(() => MSBuildGlob.Parse(invalidPathChar.ToString(), "*")); 104Assert.Throws<ArgumentNullException>(() => MSBuildGlob.Parse(null)); 177Assert.Throws<ArgumentNullException>(() => glob.IsMatch(null));
Graph\ProjectGraph_Tests.cs (1)
126Assert.Throws<InternalErrorException>(() => new ProjectGraphNode(null));
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
7838Assert.Throws<Win32Exception>(() => Win32Res.GetResource(lib, resourceId, resourceType, out manifestSize));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Workspaces\WorkspaceTests_EditorFeatures.cs (1)
1441Assert.Throws<ArgumentException>(() => VersionStamp.Create(DateTime.Now));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (17)
CodeGen\CodeGenTupleTest.cs (16)
5791Assert.Throws<ArgumentNullException>(() => comp.CreateTupleTypeSymbol(null, default(ImmutableArray<string>))); 6213Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType: vt2)); 6216Assert.Throws<ArgumentNullException>(() => comp.CreateErrorTypeSymbol(null, null, 2)); 6217Assert.Throws<ArgumentException>(() => comp.CreateErrorTypeSymbol(null, "a", -1)); 6218Assert.Throws<ArgumentException>(() => comp.CreateErrorTypeSymbol(vbComp.GlobalNamespace, "a", 1)); 6220Assert.Throws<ArgumentNullException>(() => comp.CreateErrorNamespaceSymbol(null, "a")); 6221Assert.Throws<ArgumentNullException>(() => comp.CreateErrorNamespaceSymbol(vbComp.GlobalNamespace, null)); 6222Assert.Throws<ArgumentException>(() => comp.CreateErrorNamespaceSymbol(vbComp.GlobalNamespace, "a")); 6314var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(vbType, default(ImmutableArray<string>))); 6331var e = Assert.Throws<ArgumentException>(() => comp.CreateAnonymousTypeSymbol(ImmutableArray.Create(vbType), ImmutableArray.Create("m1"))); 6341Assert.Throws<ArgumentNullException>(() => comp.CreateTupleTypeSymbol(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<string>))); 6344Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(ImmutableArray<ITypeSymbol>.Empty, default(ImmutableArray<string>))); 6586Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, vbType), default(ImmutableArray<string>))); 6802var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty)); 6842var e = Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: CreateAnnotations(CodeAnalysis.NullableAnnotation.NotAnnotated, 8))); 10959Assert.Throws<ArgumentNullException>(() => Compilation.GetRequiredLanguageVersion(null));
Emit\CompilationEmitTests.cs (1)
5180Assert.Throws<ArgumentException>(() => compilation.Emit(outReal));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (20)
Diagnostics\DiagnosticSuppressorTests.cs (1)
681Assert.Throws<OperationCanceledException>(() => compilation.GetAnalyzerDiagnostics(analyzersAndSuppressors, reportSuppressedDiagnostics: true, cancellationToken: cancellationToken));
FlowAnalysis\RegionAnalysisTests.cs (6)
3103Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeControlFlow(statement, null)); 3104Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeControlFlow(null, statement)); 3105Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeControlFlow(null)); 3106Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeDataFlow(null, statement)); 3107Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeDataFlow(statement, null)); 3108Assert.Throws<ArgumentNullException>(() => semanticModel.AnalyzeDataFlow((StatementSyntax)null));
Semantics\CollectionExpressionTests.cs (2)
27064Assert.Throws<ArgumentNullException>(() => spread.GetElementConversion()); 27071Assert.Throws<ArgumentException>(() => spread.GetElementConversion());
Semantics\OutVarTests.cs (2)
1104Assert.Throws<NotSupportedException>(() => model.AnalyzeDataFlow(dataFlowParent)); 32791Assert.Throws<NotSupportedException>(() => model.AnalyzeDataFlow(dataFlowParent));
Semantics\PatternMatchingTestBase.cs (1)
327Assert.Throws<NotSupportedException>(() => model.AnalyzeDataFlow(dataFlowParent));
Semantics\PrimaryConstructorTests.cs (4)
2195Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, (PrimaryConstructorBaseTypeSyntax)null, out _)); 2196Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, baseWithargs, out _)); 2334Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, (PrimaryConstructorBaseTypeSyntax)null, out _)); 2335Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, baseWithargs, out _));
Semantics\RecordTests.cs (4)
22352Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, (PrimaryConstructorBaseTypeSyntax)null!, out _)); 22353Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, baseWithargs, out _)); 22491Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, (PrimaryConstructorBaseTypeSyntax)null!, out _)); 22492Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(baseWithargs.ArgumentList.OpenParenToken.SpanStart, baseWithargs, out _));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (20)
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (13)
854Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraph(null)); 855Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraph(lambdaD1.Symbol)); 856Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(null)); 857Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(lambdaD1.Symbol)); 870Assert.Throws<ArgumentNullException>(() => graphM.GetAnonymousFunctionControlFlowGraph(null)); 871Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetAnonymousFunctionControlFlowGraph(lambdaD2)); 872Assert.Throws<ArgumentNullException>(() => graphM.GetAnonymousFunctionControlFlowGraphInScope(null)); 873Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetAnonymousFunctionControlFlowGraphInScope(lambdaD2)); 912Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraph(null)); 913Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraph(lambdaD1.Symbol)); 914Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(null)); 915Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(lambdaD1.Symbol)); 927Assert.Throws<ArgumentOutOfRangeException>(() => graphD2.GetAnonymousFunctionControlFlowGraph(lambdaD1));
IOperation\IOperationTests_IArgument.cs (2)
3072Assert.Throws<ArgumentException>(() => argument.GetInConversion()); 3073Assert.Throws<ArgumentException>(() => argument.GetOutConversion());
IOperation\IOperationTests_ILocalFunctionStatement.cs (5)
1816Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraph(null)); 1817Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraph(localFunctionD2)); 1818Assert.Throws<ArgumentNullException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(null)); 1819Assert.Throws<ArgumentOutOfRangeException>(() => graphM.GetLocalFunctionControlFlowGraphInScope(localFunctionD2)); 1868Assert.Throws<ArgumentOutOfRangeException>(() => graphD2.GetLocalFunctionControlFlowGraph(localFunctionD1));
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (17)
InteractiveSessionTests.cs (4)
502Assert.Throws<ArgumentException>(() => compilation2.IsSymbolAccessibleWithin(c3C3, c3C1)); 624Assert.Throws<CompilationErrorException>(() => s0.ContinueWithAsync("invalid$syntax").Result); 628Assert.Throws<CompilationErrorException>(() => s1.ContinueWithAsync("invalid$syntax").Result); 629Assert.Throws<CompilationErrorException>(() => s1.ContinueWithAsync("x = undefined_symbol").Result);
PrintOptionsTests.cs (5)
21Assert.Throws<ArgumentNullException>(() => s_formatter.FormatObject("hello", options: null)); 27Assert.Throws<ArgumentOutOfRangeException>(() => new PrintOptions().NumberRadix = 3); 33Assert.Throws<ArgumentOutOfRangeException>(() => new PrintOptions().MemberDisplayFormat = (MemberDisplayFormat)(-1)); 39Assert.Throws<ArgumentOutOfRangeException>(() => new PrintOptions().MaximumOutputLength = -1); 40Assert.Throws<ArgumentOutOfRangeException>(() => new PrintOptions().MaximumOutputLength = 0);
ScriptOptionsTests.cs (1)
37Assert.Throws<InvalidOperationException>(() => options.WithLanguageVersion(LanguageVersion.CSharp8));
ScriptTests.cs (7)
46Assert.Throws<ArgumentNullException>(() => CSharpScript.Create((string)null)); 59Assert.Throws<ArgumentNullException>(() => CSharpScript.Create((Stream)null, ScriptOptions)); 448Assert.Throws<ArgumentException>(() => state.GetVariable("x").Value = "str"); 449Assert.Throws<InvalidOperationException>(() => state.GetVariable("y").Value = "str"); 450Assert.Throws<InvalidOperationException>(() => state.GetVariable("z").Value = "str"); 451Assert.Throws<InvalidOperationException>(() => state.GetVariable("y").Value = 0); 452Assert.Throws<InvalidOperationException>(() => state.GetVariable("z").Value = 0);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (23)
Semantics\AccessCheckTests.cs (1)
975Assert.Throws<ArgumentException>(() => compilation.IsSymbolAccessibleWithin(classC, classQ));
Semantics\AccessibilityTests.cs (3)
42Assert.Throws<ArgumentNullException>(() => 49Assert.Throws<ArgumentOutOfRangeException>(() => 52Assert.Throws<ArgumentOutOfRangeException>(() =>
Semantics\LambdaTests.cs (3)
8021Assert.Throws<InvalidOperationException>(() => lambdas[0].Symbol.Parameters[0].ExplicitDefaultValue); 8031Assert.Throws<InvalidOperationException>(() => lambdas[1].Symbol.Parameters[0].ExplicitDefaultValue); 8038Assert.Throws<InvalidOperationException>(() => lambdas[2].Symbol.Parameters[0].ExplicitDefaultValue);
Semantics\MemberResolutionResultTests.cs (1)
24Assert.Throws<NotSupportedException>(() => d.GetHashCode());
Semantics\ScriptSemanticsTests.cs (1)
874Assert.Throws<InvalidOperationException>(() => CreateSubmission("a + 1", previous: s0));
Semantics\SyntaxTreeRootTests.cs (4)
62Assert.Throws<ArgumentException>(() => CSharpCompilation.Create("Grrr", syntaxTrees: new[] { arbitraryTree })); 63Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("Wah").AddSyntaxTrees(arbitraryTree)); 64Assert.Throws<ArgumentException>(() => CSharpCompilation.Create("Bahh", syntaxTrees: new[] { parsedTree }).ReplaceSyntaxTree(parsedTree, arbitraryTree)); 65Assert.Throws<ArgumentException>(() => CSharpCompilation.Create("Woo").GetSemanticModel(arbitraryTree));
Semantics\TopLevelStatementsTests.cs (1)
1982Assert.Throws<System.ArgumentException>(() => CreateCompilation(new[] { Parse(text1, filename: "text1", DefaultParseOptions),
SourceGeneration\GeneratorDriverTests.cs (7)
763Assert.Throws<OperationCanceledException>(() => 1652Assert.Throws<InvalidOperationException>(() => throwsFunc(20, CancellationToken.None)); 1665Assert.Throws<OperationCanceledException>(() => timeoutFunc(30, new CancellationToken(true))); 1669Assert.Throws<OperationCanceledException>(() => otherTimeoutFunc(30, CancellationToken.None)); 2473Assert.Throws<OperationCanceledException>(() => driver = driver.RunGenerators(compilation, cancellationToken: cts.Token)); 2536Assert.Throws<ArgumentNullException>(() => driver.WithUpdatedParseOptions(null!)); 2687Assert.Throws<ArgumentNullException>(() => driver.WithUpdatedAnalyzerConfigOptions(null!));
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
1996Assert.Throws<OperationCanceledException>(() => driver = driver.RunGenerators(compilation, cancellationToken: cts.Token)); 2025Assert.Throws<OperationCanceledException>(() => driver = driver.RunGenerators(compilation, cancellationToken: cts.Token));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (123)
Compilation\CompilationAPITests.cs (68)
389Assert.Throws<ArgumentException>(() => c.Emit(peStream)); 390Assert.Throws<ArgumentException>(() => c.Emit(new MemoryStream(), pdbStream)); 819Assert.Throws<ArgumentException>(() => comp.AddSyntaxTrees(t1)); 822Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(t1, comp.SyntaxTrees[0])); 825Assert.Throws<ArgumentException>(() => comp = comp.RemoveSyntaxTrees(SyntaxFactory.ParseSyntaxTree(s1))); 829Assert.Throws<ArgumentException>(() => comp = comp.RemoveSyntaxTrees(withErrorTree)); 857Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t5).RemoveSyntaxTrees(col)); 868Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t6).RemoveSyntaxTrees(stack)); 879Assert.Throws<ArgumentException>(() => compCollection = compCollection.AddSyntaxTrees(t4, t6).RemoveSyntaxTrees(queue)); 914Assert.Throws<ArgumentException>(() => CSharpCompilation.Create("Compilation", new SyntaxTree[] { withExpressionRootTree })); 917Assert.Throws<ArgumentException>(() => comp.AddSyntaxTrees(withExpressionRootTree)); 920Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(comp.SyntaxTrees[0], withExpressionRootTree)); 957Assert.Throws<ArgumentException>(() => comp = comp.AddSyntaxTrees(listSyntaxTree).AddReferences().ReplaceSyntaxTree(t1, t2)); 1297Assert.Throws<ArgumentException>(() => comp.AddReferences(compRef)); 1341Assert.Throws<ArgumentNullException>(() => CSharpCompilation.Create("goo", syntaxTrees: new SyntaxTree[] { null })); 1342Assert.Throws<ArgumentNullException>(() => CSharpCompilation.Create("goo", references: new MetadataReference[] { null })); 1382Assert.Throws<ArgumentException>(() => comp.AddReferences(compRef)); 1428Assert.Throws<ArgumentException>(() => comp.AddReferences(listRef).AddReferences(ref2).RemoveReferences(ref1, ref2, ref3, ref4).ReplaceReference(ref2, ref2)); 1438Assert.Throws<ArgumentException>(() => comp = comp.RemoveReferences(ref1)); 1443Assert.Throws<ArgumentException>(() => comp = comp.ReplaceReference(MscorlibRef, ref1)); 1489Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(newTree: SyntaxFactory.ParseSyntaxTree("Using System;"), oldTree: t1)); 1556Assert.Throws<ArgumentException>(() => (comp.AddSyntaxTrees(t1, t1))); 2400Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: genericParameter)); 2401Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: open)); 2402Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: typeof(void))); 2403Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", returnType: byref)); 2405Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: genericParameter)); 2406Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: open)); 2407Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: typeof(void))); 2408Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: typeof(int))); 2409Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: ptr)); 2410Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", globalsType: byref)); 2413Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a1", previousScriptCompilation: s0, globalsType: typeof(List<bool>))); 2416Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseExe)); 2417Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.NetModule))); 2418Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeMetadata))); 2419Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeApplication))); 2420Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsApplication))); 2421Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithCryptoKeyContainer("goo"))); 2422Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithCryptoKeyFile("goo.snk"))); 2423Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithDelaySign(true))); 2424Assert.Throws<ArgumentException>(() => CSharpCompilation.CreateScriptCompilation("a", options: TestOptions.ReleaseDll.WithDelaySign(false))); 2453Assert.Throws<InvalidOperationException>(() => CreateSubmission("a + 1", previous: s0)); 2468Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, default)); 2469Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, 0)); 2476Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, rank: default)); 2477Assert.Throws<ArgumentException>(() => comp.CreateArrayTypeSymbol(elementType, rank: 0)); 2508Assert.Throws<ArgumentException>(() => 2518Assert.Throws<ArgumentException>(() => 2530Assert.Throws<ArgumentException>(() => 2542Assert.Throws<ArgumentException>(() => 2554Assert.Throws<ArgumentNullException>(() => 2566Assert.Throws<ArgumentNullException>(() => 2576Assert.Throws<ArgumentNullException>(() => 2586Assert.Throws<ArgumentNullException>(() => 2596Assert.Throws<ArgumentNullException>(() => 2705Assert.Throws<ArgumentException>(() => comp.CreateAnonymousTypeSymbol(memberTypes, memberNames, memberNullableAnnotations: ImmutableArray.Create(CodeAnalysis.NullableAnnotation.NotAnnotated))); 2771Assert.Throws<ArgumentException>(() => 3034Assert.Throws<ArgumentException>(() => genericType.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>))); 3035Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments: default, typeArgumentNullableAnnotations: default)); 3042Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty)); 3043Assert.Throws<ArgumentException>(() => genericType.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default)); 3053Assert.Throws<ArgumentException>(() => genericType.Construct(typeArguments, default)); 3069Assert.Throws<ArgumentException>(() => genericMethod.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>))); 3070Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments: default, typeArgumentNullableAnnotations: default)); 3077Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty)); 3078Assert.Throws<ArgumentException>(() => genericMethod.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default)); 3088Assert.Throws<ArgumentException>(() => genericMethod.Construct(typeArguments, default));
Compilation\GetSemanticInfoTests.cs (10)
4053Assert.Throws<InvalidOperationException>(() => method1.ReducedFrom.GetTypeInferredDuringReduction(null)); 4054Assert.Throws<ArgumentNullException>(() => method1.GetTypeInferredDuringReduction(null)); 5408Assert.Throws<InvalidOperationException>(() => type.Construct(objectType)); // non-generic type 5414Assert.Throws<InvalidOperationException>(() => type.Construct(objectType)); // non-generic type 5420Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg 5421Assert.Throws<ArgumentException>(() => type.Construct()); // typeArgs.Length != Arity 5422Assert.Throws<InvalidOperationException>(() => type.Construct(objectType).Construct(objectType)); // constructed type 5428Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg 5429Assert.Throws<ArgumentException>(() => type.Construct()); // typeArgs.Length != Arity 5430Assert.Throws<InvalidOperationException>(() => type.Construct(objectType).Construct(objectType)); // constructed type
Compilation\ReferenceManagerTests.cs (1)
2144Assert.Throws<ObjectDisposedException>(() => compilation.GetTypeByMetadataName("System.Int64").GetMembers());
Compilation\SemanticModelAPITests.cs (9)
2181Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, statement: null, speculativeModel: out speculativeModel)); 2182Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, constructorInitializer: (ConstructorInitializerSyntax)null, speculativeModel: out speculativeModel)); 2183Assert.Throws<ArgumentNullException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, attribute: null, speculativeModel: out speculativeModel)); 2186Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(statement.SpanStart, statement: statement, speculativeModel: out speculativeModel)); 2187Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(ctorInitializer.SpanStart, constructorInitializer: ctorInitializer, speculativeModel: out speculativeModel)); 2188Assert.Throws<ArgumentException>(() => model.TryGetSpeculativeSemanticModel(attribute.SpanStart, attribute: attribute, speculativeModel: out speculativeModel)); 2193Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, speculatedStatement, speculativeModel: out speculativeModel)); 2235Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, newSpeculatedStatement, out newModel)); 2239Assert.Throws<InvalidOperationException>(() => speculativeModel.TryGetSpeculativeSemanticModel(speculatedStatement.SpanStart, newSpeculatedStatement, out newModel));
Compilation\SemanticModelGetSemanticInfoTests.cs (7)
1665Assert.Throws<ArgumentNullException>(() => model.GetSymbolInfo((ExpressionSyntax)null)); 1666Assert.Throws<ArgumentNullException>(() => model.GetTypeInfo((ExpressionSyntax)null)); 1667Assert.Throws<ArgumentNullException>(() => model.GetMemberGroup((ExpressionSyntax)null)); 1668Assert.Throws<ArgumentNullException>(() => model.GetConstantValue((ExpressionSyntax)null)); 1670Assert.Throws<ArgumentNullException>(() => model.GetSymbolInfo((ConstructorInitializerSyntax)null)); 1671Assert.Throws<ArgumentNullException>(() => model.GetTypeInfo((ConstructorInitializerSyntax)null)); 1672Assert.Throws<ArgumentNullException>(() => model.GetMemberGroup((ConstructorInitializerSyntax)null));
DocumentationComments\DocumentationCommentCompilerTests.cs (1)
3355Assert.Throws<XmlException>(() => XElement.Parse(xml));
Symbols\AnonymousTypesSemanticsTests.cs (1)
1980Assert.Throws<InvalidOperationException>(() => namedType.Construct(args));
Symbols\CorLibrary\CorTypes.cs (3)
228Assert.Throws<ArgumentOutOfRangeException>(() => c1.GetSpecialType(SpecialType.None)); 229Assert.Throws<ArgumentOutOfRangeException>(() => ((Compilation)c1).GetSpecialType(SpecialType.None)); 231Assert.Throws<ArgumentOutOfRangeException>(() => ((Compilation)c1).GetSpecialType(SpecialType.Count + 1));
Symbols\CustomModifiersTests.cs (13)
69Assert.Throws<System.IndexOutOfRangeException>(() => type.GetTypeArgumentCustomModifiers(1)); 70Assert.Throws<System.IndexOutOfRangeException>(() => type.GetTypeArgumentCustomModifiers(-1)); 75Assert.Throws<System.IndexOutOfRangeException>(() => nullable.GetTypeArgumentCustomModifiers(1)); 76Assert.Throws<System.IndexOutOfRangeException>(() => nullable.GetTypeArgumentCustomModifiers(-1)); 80Assert.Throws<System.IndexOutOfRangeException>(() => i.GetTypeArgumentCustomModifiers(0)); 85Assert.Throws<System.IndexOutOfRangeException>(() => nullable.GetTypeArgumentCustomModifiers(1)); 86Assert.Throws<System.IndexOutOfRangeException>(() => nullable.GetTypeArgumentCustomModifiers(-1)); 144Assert.Throws<System.IndexOutOfRangeException>(() => type.GetTypeArgumentCustomModifiers(2)); 145Assert.Throws<System.IndexOutOfRangeException>(() => type.GetTypeArgumentCustomModifiers(-1)); 151Assert.Throws<System.IndexOutOfRangeException>(() => dictionary.GetTypeArgumentCustomModifiers(2)); 152Assert.Throws<System.IndexOutOfRangeException>(() => dictionary.GetTypeArgumentCustomModifiers(-1)); 159Assert.Throws<System.IndexOutOfRangeException>(() => dictionary.GetTypeArgumentCustomModifiers(2)); 160Assert.Throws<System.IndexOutOfRangeException>(() => dictionary.GetTypeArgumentCustomModifiers(-1));
Symbols\FunctionPointerTypeSymbolTests.cs (9)
1537Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1538Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.Out, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1539Assert.Throws<ArgumentOutOfRangeException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: (SignatureCallingConvention)10)); 1540Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Default, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1541Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.StdCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1542Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.FastCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1543Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.CDecl, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1544Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.ThisCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1545Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, callingConventionTypes: ImmutableArray.Create(@string)!));
Symbols\Source\FileModifierTests.cs (1)
4590var ex = Assert.Throws<ArgumentException>(() => CreateCompilation(new[] { tree, tree }));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (101)
LexicalAndXml\SyntaxTokenParserTests.cs (1)
22Assert.Throws<NullReferenceException>(() => parser.ParseNextToken());
Syntax\SeparatedSyntaxListTests.cs (11)
43Assert.Throws<NotSupportedException>(() => default(SeparatedSyntaxList<CSharpSyntaxNode>.Enumerator).GetHashCode()); 44Assert.Throws<NotSupportedException>(() => default(SeparatedSyntaxList<CSharpSyntaxNode>.Enumerator).Equals(default(SeparatedSyntaxList<CSharpSyntaxNode>.Enumerator))); 267Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0)); 268Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, nodeD)); 269Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, nodeD)); 270Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(1, new[] { nodeD })); 271Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { nodeD })); 272Assert.Throws<ArgumentNullException>(() => list.Add(null)); 273Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxNode>)null)); 274Assert.Throws<ArgumentNullException>(() => list.Insert(0, null)); 275Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxNode>)null));
Syntax\SyntaxFactoryTests.cs (4)
103Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(SyntaxKind.NumericLiteralExpression)); 141Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList))); 142Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList))); 143Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList)));
Syntax\SyntaxListTests.cs (13)
39Assert.Throws<NotSupportedException>(() => default(SyntaxList<CSharpSyntaxNode>.Enumerator).GetHashCode()); 40Assert.Throws<NotSupportedException>(() => default(SyntaxList<CSharpSyntaxNode>.Enumerator).Equals(default(SyntaxList<CSharpSyntaxNode>.Enumerator))); 219Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0)); 220Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, nodeD)); 221Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, nodeD)); 222Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(1, new[] { nodeD })); 223Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { nodeD })); 224Assert.Throws<ArgumentException>(() => list.Replace(nodeD, nodeE)); 225Assert.Throws<ArgumentException>(() => list.ReplaceRange(nodeD, new[] { nodeE })); 226Assert.Throws<ArgumentNullException>(() => list.Add(null)); 227Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxNode>)null)); 228Assert.Throws<ArgumentNullException>(() => list.Insert(0, null)); 229Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxNode>)null));
Syntax\SyntaxNodeOrTokenListTests.cs (11)
33Assert.Throws<NotSupportedException>(() => default(SyntaxNodeOrTokenList.Enumerator).GetHashCode()); 34Assert.Throws<NotSupportedException>(() => default(SyntaxNodeOrTokenList.Enumerator).Equals(default(SyntaxNodeOrTokenList.Enumerator))); 208Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0)); 209Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, tokenD)); 210Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, tokenD)); 211Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(1, new[] { tokenD })); 212Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { tokenD })); 213Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxNodeOrToken))); 214Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxNodeOrToken))); 215Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxNodeOrToken>)null)); 216Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxNodeOrToken>)null));
Syntax\SyntaxNodeTests.cs (20)
751Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(EOFSpan)); 761Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(nodeEndPositionSpan)); 765Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 767Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 769Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 771Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 773Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(root.FullSpan)); 2156Assert.Throws<InvalidOperationException>(() => ifstatement.ReplaceNode(then, new[] { stat1, stat2 })); 2159Assert.Throws<InvalidOperationException>(() => ifstatement.ReplaceNode(then, new StatementSyntax[] { })); 2196Assert.Throws<InvalidOperationException>(() => ifstatement.InsertNodesBefore(then, new[] { stat1, stat2 })); 2199Assert.Throws<InvalidOperationException>(() => ifstatement.InsertNodesAfter(then, new StatementSyntax[] { })); 2297Assert.Throws<InvalidOperationException>(() => cu.ReplaceToken(identifierC, new[] { identifierA, identifierB })); 2300Assert.Throws<InvalidOperationException>(() => cu.ReplaceToken(identifierC, new SyntaxToken[] { })); 2328Assert.Throws<InvalidOperationException>(() => cu.InsertTokensBefore(identifierC, new[] { identifierA, identifierB })); 2331Assert.Throws<InvalidOperationException>(() => cu.InsertTokensAfter(identifierC, new[] { identifierA, identifierB })); 3522Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken })); 3523Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken })); 3524Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, intType })); 3711Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChanges(BlankTree)); 3744Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChangedSpans(BlankTree));
Syntax\SyntaxTests.cs (2)
33Assert.Throws<ArgumentNullException>(() => SyntaxFactory.IsCompleteSubmission(null)); 34Assert.Throws<ArgumentException>(() =>
Syntax\SyntaxTokenListTests.cs (15)
53Assert.Throws<NotSupportedException>(() => default(SyntaxTokenList.Enumerator).GetHashCode()); 54Assert.Throws<NotSupportedException>(() => default(SyntaxTokenList.Enumerator).Equals(default(SyntaxTokenList.Enumerator))); 55Assert.Throws<NotSupportedException>(() => default(SyntaxTokenList.Reversed.Enumerator).GetHashCode()); 56Assert.Throws<NotSupportedException>(() => default(SyntaxTokenList.Reversed.Enumerator).Equals(default(SyntaxTokenList.Reversed.Enumerator))); 228Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0)); 229Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, tokenD)); 230Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, tokenD)); 231Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { tokenD })); 232Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(list.Count + 1, new[] { tokenD })); 233Assert.Throws<ArgumentOutOfRangeException>(() => list.Replace(tokenD, tokenE)); 234Assert.Throws<ArgumentOutOfRangeException>(() => list.ReplaceRange(tokenD, new[] { tokenE })); 235Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxToken))); 236Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxToken))); 237Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxToken>)null)); 238Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxToken>)null));
Syntax\SyntaxTriviaListTests.cs (22)
169Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, triviaD)); 170Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(list.Count + 1, triviaD)); 171Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { triviaD })); 172Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(list.Count + 1, new[] { triviaD })); 173Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(-1)); 174Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(list.Count)); 175Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxTrivia))); 176Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxTrivia))); 177Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxTrivia>)null)); 178Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxTrivia>)null)); 179Assert.Throws<ArgumentNullException>(() => list.ReplaceRange(elementA, (IEnumerable<SyntaxTrivia>)null)); 216Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(0)); 217Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(1, triviaD)); 218Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, triviaD)); 219Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(1, new[] { triviaD })); 220Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(-1, new[] { triviaD })); 221Assert.Throws<ArgumentOutOfRangeException>(() => list.Replace(triviaD, triviaE)); 222Assert.Throws<ArgumentOutOfRangeException>(() => list.ReplaceRange(triviaD, new[] { triviaE })); 223Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxTrivia))); 224Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxTrivia))); 225Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxTrivia>)null)); 226Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxTrivia>)null));
Syntax\TrackNodeTests.cs (2)
127Assert.Throws<InvalidOperationException>(() => replacedExpr.GetCurrentNode(originalA)); 184Assert.Throws<ArgumentException>(() => expr.TrackNodes(SyntaxFactory.IdentifierName("c")));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (5)
Emit\CompilationOutputsTests.cs (4)
88Assert.Throws<ObjectDisposedException>(() => currentPEStream!.Length); 92Assert.Throws<ObjectDisposedException>(() => currentPdbStream!.Length); 103Assert.Throws<ObjectDisposedException>(() => currentPEStream.Length); 108Assert.Throws<ObjectDisposedException>(() => currentPEStream.Length);
Extensions\SourceTextContainerExtensionsTests.cs (1)
20Assert.Throws<ArgumentException>(() => Microsoft.CodeAnalysis.Text.Extensions.GetTextBuffer(containerMock.Object));
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (14)
MetadataShadowCopyProviderTests.cs (14)
57Assert.Throws<ArgumentNullException>(() => _provider.NeedsShadowCopy(null)); 58Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy("c:goo.dll")); 59Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy("bar.dll")); 60Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy(@"\bar.dll")); 61Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy(@"../bar.dll")); 70Assert.Throws<ArgumentNullException>(() => _provider.GetMetadataShadowCopy(null, MetadataImageKind.Assembly)); 71Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("c:goo.dll", MetadataImageKind.Assembly)); 72Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("bar.dll", MetadataImageKind.Assembly)); 73Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"\bar.dll", MetadataImageKind.Assembly)); 74Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"../bar.dll", MetadataImageKind.Assembly)); 77Assert.Throws<ArgumentNullException>(() => _provider.GetMetadata(null, MetadataImageKind.Assembly)); 78Assert.Throws<ArgumentException>(() => _provider.GetMetadata("c:goo.dll", MetadataImageKind.Assembly)); 187Assert.Throws<BadImageFormatException>(() => _provider.GetMetadata(f0, MetadataImageKind.Assembly)); 190Assert.Throws<FileNotFoundException>(() => _provider.GetMetadata(f1, MetadataImageKind.Assembly));
Microsoft.CodeAnalysis.Test.Utilities (4)
Compilation\TestOperationVisitor.cs (4)
96Assert.Throws<InvalidOperationException>(() => operation.ChildOperations.First()); 97Assert.Throws<InvalidOperationException>(() => operation.ChildOperations.Last()); 852Assert.Throws<ArgumentException>(() => VisualBasic.VisualBasicExtensions.GetConversion(operation)); 856Assert.Throws<ArgumentException>(() => CSharp.CSharpExtensions.GetConversion(operation));
Microsoft.CodeAnalysis.UnitTests (233)
AnalyzerAssemblyLoaderTests.cs (1)
388var exception = Assert.Throws<TargetInvocationException>(
Analyzers\AnalyzerConfigTests.cs (6)
1482Assert.Throws<ArgumentException>(() => Parse("", "relativeDir/file")); 1483Assert.Throws<ArgumentException>(() => Parse("", "/")); 1484Assert.Throws<ArgumentException>(() => Parse("", "/subdir/")); 1490Assert.Throws<ArgumentException>(() => Parse("", "Z:")); 1491Assert.Throws<ArgumentException>(() => Parse("", "Z:\\")); 1492Assert.Throws<ArgumentException>(() => Parse("", ":\\.editorconfig"));
Collections\HashSet\ISet_Generic_Tests`1.cs (7)
315Assert.Throws<ArgumentNullException>(() => set.IsProperSubsetOf(null!)); 316Assert.Throws<ArgumentNullException>(() => set.IsProperSupersetOf(null!)); 317Assert.Throws<ArgumentNullException>(() => set.IsSubsetOf(null!)); 318Assert.Throws<ArgumentNullException>(() => set.IsSupersetOf(null!)); 319Assert.Throws<ArgumentNullException>(() => set.Overlaps(null!)); 320Assert.Throws<ArgumentNullException>(() => set.SetEquals(null!)); 330Assert.Throws<NotSupportedException>(() => set.Add(CreateT(0)));
Collections\IdentifierCollectionTests.cs (1)
82Assert.Throws<NotSupportedException>(() => collection.Remove("x"));
Collections\ImmutableArrayExtensionsTests.cs (8)
29Assert.Throws<ArgumentNullException>(() => ImmutableArray.CreateRange<int>((IEnumerable<int>)null)); 57Assert.Throws<NullReferenceException>(() => nullOrEmpty.IsEmpty); 143Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single()); 144Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single()); 146Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2).Single()); 150Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single(isOdd)); 151Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single(isOdd)); 153Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2, 3).Single(isOdd));
Collections\ImmutableDictionaryBuilderTestBase.cs (1)
74Assert.Throws<KeyNotFoundException>(() => builder["foo"]);
Collections\ImmutableDictionaryTestBase.cs (6)
107Assert.Throws<KeyNotFoundException>(() => this.Empty<int, int>()[3]); 132Assert.Throws<NotSupportedException>(() => dictionary.Remove(new KeyValuePair<string, int>())); 158Assert.Throws<NotSupportedException>(() => dictionary.Remove("a")); 159Assert.Throws<NotSupportedException>(() => dictionary["a"] = 2); 160Assert.Throws<KeyNotFoundException>(() => dictionary["a"]); 170Assert.Throws<NotSupportedException>(() => dictionary["a"] = 2);
Collections\ImmutableDictionaryTestBase.nonnetstandard.cs (2)
50Assert.Throws<NotSupportedException>(() => map.Remove(5)); 64Assert.Throws<NotSupportedException>(() => map[3] = 5);
Collections\ImmutableSegmentedDictionaryBuilderTest.cs (1)
262TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null));
Collections\ImmutableSegmentedDictionaryTest.cs (1)
262TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null));
Collections\ImmutableSegmentedHashSetBuilderTest.cs (1)
92Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext());
Collections\ImmutableSegmentedHashSetTest.cs (1)
198TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null));
Collections\ImmutableSegmentedListBuilderTest.cs (1)
372TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object)null!));
Collections\ImmutableSegmentedListTest.cs (5)
748Assert.Throws<NotSupportedException>(() => list.Add(1)); 753Assert.Throws<NotSupportedException>(() => list[0] = 1); 764Assert.Throws<NotSupportedException>(() => list.Remove(1)); 766Assert.Throws<NotSupportedException>(() => list[0] = 1); 787TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null));
Collections\ImmutableSetTest.cs (2)
172Assert.Throws<NotSupportedException>(() => set.Add(0)); 185Assert.Throws<NotSupportedException>(() => set.Remove(1));
Collections\IndexOfTests.cs (17)
33Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default)); 34Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default)); 35Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default)); 36Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default)); 37Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, new CustomComparer(50))); 38Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, new CustomComparer(50))); 39Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, 20, new CustomComparer(1))); 40Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, -1, new CustomComparer(1))); 102Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default)); 103Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default)); 104Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default)); 105Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default)); 106Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, new CustomComparer(50))); 107Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, new CustomComparer(50))); 108Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, 20, new CustomComparer(1))); 109Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, -1, new CustomComparer(1))); 110Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndex(collection1256, 2, 5));
Collections\List\ICollection.Generic.Tests.cs (4)
456Assert.Throws<ArgumentException>(() => collection.Contains(invalidValue)) 560Assert.Throws<NotSupportedException>(() => collection.Remove(CreateT(34543))); 677Assert.Throws<ArgumentException>(() => collection.Remove(value)); 690Assert.Throws<ArgumentNullException>(() => collection.Remove(default(T)!));
Collections\List\ICollection.NonGeneric.Tests.cs (1)
154Assert.Throws<NotSupportedException>(() => collection.SyncRoot);
Collections\List\IEnumerable.Generic.Tests.cs (10)
166Assert.Throws<InvalidOperationException>( 179Assert.Throws<InvalidOperationException>( 217Assert.Throws<InvalidOperationException>(() => enumerator.Current); 315Assert.Throws<InvalidOperationException>(() => enumerator.Current); 434Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 480Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 524Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 654Assert.Throws<InvalidOperationException>(() => enumerator.Current); 670Assert.Throws<InvalidOperationException>(() => enumerator.Current); 689Assert.Throws<InvalidOperationException>(() => enumerator.Current);
Collections\List\IEnumerable.NonGeneric.Tests.cs (6)
203Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 229Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 252Assert.Throws<InvalidOperationException>(() => enumerator.MoveNext()); 316Assert.Throws<InvalidOperationException>(() => enumerator.Current); 330Assert.Throws<InvalidOperationException>(() => enumerator.Current); 347Assert.Throws<InvalidOperationException>(() => enumerator.Current);
Collections\List\IList.Generic.Tests.cs (8)
177Assert.Throws<NotSupportedException>(() => list[count / 2] = CreateT(321432)); 209Assert.Throws<ArgumentNullException>(() => list[0] = default(T)!); 244Assert.Throws<ArgumentNullException>(() => list[lastIndex] = default(T)!); 274Assert.Throws<ArgumentException>(() => list[count / 2] = value); 302Assert.Throws<ArgumentNullException>(() => list.IndexOf(default(T)!)); 372Assert.Throws<ArgumentException>(() => list.IndexOf(value)); 628Assert.Throws<InvalidOperationException>(() => enumerator.Current); // enumerator.Current should fail 644Assert.Throws<InvalidOperationException>(() => enumerator.Current); // enumerator.Current should fail
Collections\List\IList.NonGeneric.Tests.cs (7)
281Assert.Throws<NotSupportedException>(() => list[count / 2] = CreateT(321432)); 364Assert.Throws<ArgumentException>(() => list[count / 2] = value); 511Assert.Throws<NotSupportedException>(() => collection.Add(CreateT(0))); 620Assert.Throws<ArgumentException>(() => collection.Contains(invalidValue)) 700Assert.Throws<ArgumentException>(() => list.IndexOf(value)); 1097Assert.Throws<InvalidOperationException>(() => enumerator.Current); // Enumerator.Current should fail 1112Assert.Throws<InvalidOperationException>(() => enumerator.Current); // Enumerator.Current should fail
Collections\SegmentedArrayTests.cs (2)
56Assert.Throws<NullReferenceException>(() => ((IList)data)[0]); 57Assert.Throws<NullReferenceException>(() => ((IList)data)[0] = IntPtr.Zero);
Diagnostics\CompilationWithAnalyzersTests.cs (3)
31Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(default(ImmutableArray<Diagnostic>), c)); 32Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(null, c)); 33Assert.Throws<ArgumentNullException>(() => CompilationWithAnalyzers.GetEffectiveDiagnostics(ds, null));
Diagnostics\OperationTests.cs (12)
77Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentName(0)); 78Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentRefKind(0)); 92Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentName(0)); 93Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentRefKind(0)); 107Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentName(0)); 108Assert.Throws<ArgumentNullException>(() => nullDynamicExpression.GetArgumentRefKind(0)); 120Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IBlockOperation)null)); 121Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IFieldInitializerOperation)null)); 122Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IPropertyInitializerOperation)null)); 123Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IParameterInitializerOperation)null)); 124Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IConstructorBodyOperation)null)); 125Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IMethodBodyOperation)null));
EmbeddedTextTests.cs (4)
60Assert.Throws<IOException>(() => EmbeddedText.FromStream("path", new HugeStream())); 61Assert.Throws<EndOfStreamException>(() => EmbeddedText.FromStream("path", new TruncatingStream(10))); 62Assert.Throws<EndOfStreamException>(() => EmbeddedText.FromStream("path", new TruncatingStream(1000))); 63Assert.Throws<IOException>(() => EmbeddedText.FromStream("path", new ReadFailsStream()));
Emit\CustomDebugInfoTests.cs (5)
154var e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff }), ImmutableArray<byte>.Empty)); 157e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty)); 160e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty)); 171e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(largeData), ImmutableArray<byte>.Empty)); 337Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(
Emit\EmitBaselineTests.cs (4)
33Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(null, peModule, debugInfoProvider, localSigProvider, true)); 34Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, null, debugInfoProvider, localSigProvider, true)); 35Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, peModule, null, localSigProvider, true)); 36Assert.Throws<ArgumentNullException>(() => EmitBaseline.CreateInitialBaseline(compilation, mdModule, debugInfoProvider, null, true));
IsSymbolAccessibleWithinTests.cs (8)
34Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Av, Av)); 35Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Av, Ac)); 36Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Ac, Av)); 37Assert.Throws<ArgumentException>(() => csc.IsSymbolAccessibleWithin(Ac, Ac, Av)); 39Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Ac, Ac)); 40Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Ac, Av)); 41Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Av, Ac)); 42Assert.Throws<ArgumentException>(() => vbc.IsSymbolAccessibleWithin(Av, Av, Ac));
MetadataReferences\AssemblyIdentityDisplayNameTests.cs (1)
367Assert.Throws<ArgumentNullException>(() => AssemblyIdentity.TryParseDisplayName(null, out id));
MetadataReferences\AssemblyIdentityTests.cs (9)
223Assert.Throws<ArgumentException>(() => new AssemblyIdentity("xx\0xx")); 224Assert.Throws<ArgumentException>(() => new AssemblyIdentity("")); 225Assert.Throws<ArgumentException>(() => new AssemblyIdentity(null)); 227Assert.Throws<ArgumentException>( 244Assert.Throws<ArgumentOutOfRangeException>(() => new AssemblyIdentity("Goo", v)); 247Assert.Throws<ArgumentOutOfRangeException>(() => new AssemblyIdentity("Goo", contentType: (AssemblyContentType)(-1))); 248Assert.Throws<ArgumentOutOfRangeException>(() => new AssemblyIdentity("Goo", contentType: (AssemblyContentType)int.MaxValue)); 250Assert.Throws<ArgumentException>(() => 359Assert.Throws<CultureNotFoundException>(() => ai.ToAssemblyName());
MetadataReferences\AssemblyMetadataTests.cs (11)
20Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.CreateFromImage(default(ImmutableArray<byte>))); 23Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.CreateFromImage(enumerableImage)); 26Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.CreateFromImage(arrayImage)); 28Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.Create((ModuleMetadata)null)); 29Assert.Throws<ArgumentException>(() => AssemblyMetadata.Create(default(ImmutableArray<ModuleMetadata>))); 30Assert.Throws<ArgumentException>(() => AssemblyMetadata.Create(ImmutableArray.Create<ModuleMetadata>())); 38Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.Create(ImmutableArray.Create(m1, m2, null))); 39Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.Create(ImmutableArray.Create((ModuleMetadata)null))); 41Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.CreateFromFile((string)null)); 143Assert.Throws<BadImageFormatException>(() => metadata.GetModules()); 150Assert.Throws<BadImageFormatException>(() => metadata.GetModules());
MetadataReferences\AssemblyPortabilityPolicyTests.cs (3)
80Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path)); 89Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path)); 105Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path));
MetadataReferences\FusionAssemblyIdentityTests.cs (6)
207Assert.Throws<CultureNotFoundException>(() => ToAssemblyName(nameObject)); 211Assert.Throws<CultureNotFoundException>(() => ToAssemblyName(nameObject)); 213Assert.Throws<CultureNotFoundException>(() => new AssemblyName("mscorlib, Version=2.0.0.0, Culture=nonsense")); 214Assert.Throws<CultureNotFoundException>(() => new AssemblyName("mscorlib, Version=2.0.0.0, Culture=null")); 216Assert.Throws<ArgumentException>(() => FusionAssemblyIdentity.ToAssemblyNameObject(new AssemblyName { Name = "x\0x" })); 224Assert.Throws<FileLoadException>(() => name.FullName);
MetadataReferences\MetadataReferencePropertiesTests.cs (8)
42Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataReferenceProperties((MetadataImageKind)byte.MaxValue)); 43Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create("blah"))); 44Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, embedInteropTypes: true)); 45Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create(""))); 46Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create("x\0x"))); 48Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithAliases(ImmutableArray.Create("blah"))); 49Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithAliases(new[] { "blah" })); 50Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithEmbedInteropTypes(true));
MetadataReferences\MetadataReferenceTests.cs (5)
280Assert.Throws<ArgumentException>(() => r.WithAliases(new[] { "bar" })); 281Assert.Throws<ArgumentException>(() => r.WithEmbedInteropTypes(true)); 364Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module))); 395Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module))); 587Assert.Throws<BadImageFormatException>((Func<object>)((AssemblyMetadata)r.GetMetadataNoCopy()).GetAssembly);
MetadataReferences\ModuleMetadataTests.cs (19)
23Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromMetadata(IntPtr.Zero, 0)); 30Assert.Throws<BadImageFormatException>(() => metadata.GetModuleNames()); 89Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(IntPtr.Zero, 0)); 93Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(default(ImmutableArray<byte>))); 96Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(enumerableImage)); 99Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(arrayImage)); 109Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromStream(peStream: null)); 110Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromStream(new TestStream(canRead: false, canSeek: true))); 111Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromStream(new TestStream(canRead: true, canSeek: false))); 117Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromFile((string)null)); 118Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromFile("")); 119Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromFile(@"c:\*")); 122Assert.Throws<IOException>(() => ModuleMetadata.CreateFromFile(@"http://goo.bar")); 123Assert.Throws<FileNotFoundException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\file_that_does_not_exists.dll")); 124Assert.Throws<FileNotFoundException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\directory_that_does_not_exists\file_that_does_not_exists.dll")); 125Assert.Throws<PathTooLongException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\" + new string('x', 1000))); 126Assert.Throws<IOException>(() => ModuleMetadata.CreateFromFile(Environment.GetFolderPath(Environment.SpecialFolder.Windows))); 171Assert.Throws<BadImageFormatException>(() => ModuleMetadata.CreateFromStream(new MemoryStream(), PEStreamOptions.PrefetchMetadata)); 172Assert.Throws<BadImageFormatException>(() => ModuleMetadata.CreateFromStream(new MemoryStream(), PEStreamOptions.PrefetchMetadata | PEStreamOptions.PrefetchEntireImage));
ResourceDescriptionTests.cs (17)
28Assert.Throws<ArgumentNullException>(() => new ResourceDescription(null, "file", data, isPublic: true)); 29Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", null, data, isPublic: true)); 30Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", "file", null, isPublic: true)); 31Assert.Throws<ArgumentNullException>(() => new ResourceDescription(null, data, isPublic: true)); 32Assert.Throws<ArgumentNullException>(() => new ResourceDescription("res", null, isPublic: true)); 35Assert.Throws<ArgumentException>(() => new ResourceDescription("", "file", data, isPublic: true)); 36Assert.Throws<ArgumentException>(() => new ResourceDescription("res", "", data, isPublic: true)); 37Assert.Throws<ArgumentException>(() => new ResourceDescription("res", "", data, isPublic: true)); 38Assert.Throws<ArgumentException>(() => new ResourceDescription("", "file", data, isPublic: true)); 41Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x/x", data, isPublic: true)); 42Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x\\x", data, isPublic: true)); 43Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "x:x", data, isPublic: true)); 44Assert.Throws<ArgumentException>(() => new ResourceDescription("x", "\0", data, isPublic: true)); 45Assert.Throws<ArgumentException>(() => new ResourceDescription("", "x", data, isPublic: true)); 46Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx\0xxxx", "", data, isPublic: true)); 47Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx\uD800asdas", "", data, isPublic: true)); 48Assert.Throws<ArgumentException>(() => new ResourceDescription("xxx", "xxx\uD800asdas", data, isPublic: true));
Text\LargeTextTests.cs (2)
65Assert.Throws<IndexOutOfRangeException>(() => text[-1]); 66Assert.Throws<IndexOutOfRangeException>(() => text[HelloWorld.Length]);
Text\SourceTextStreamTests.cs (1)
35Assert.Throws<ArgumentException>(() => stream.Read(buffer, 0, local));
Text\SourceTextTests.cs (2)
343Assert.Throws<InvalidDataException>(() => SourceText.From(bytes, bytes.Length, throwIfBinaryDetected: true)); 346Assert.Throws<InvalidDataException>(() => SourceText.From(stream, throwIfBinaryDetected: true));
Text\StringText_LineTest.cs (7)
62Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 0))); 69Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 3))); 76Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 5))); 107Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 10))); 114Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(-1, 2))); 121Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(7, 0))); 128Assert.Throws<ArgumentNullException>(() => TextLine.FromSpan(null, new TextSpan(0, 2)));
Text\StringTextTest.cs (4)
69Assert.Throws<ArgumentNullException>(() => SourceText.From((string)null, Encoding.UTF8)); 75Assert.Throws<ArgumentNullException>(() => SourceText.From((Stream)null, Encoding.UTF8)); 76Assert.Throws<ArgumentException>(() => SourceText.From(new TestStream(canRead: false, canSeek: true), Encoding.UTF8)); 77Assert.Throws<NotImplementedException>(() => SourceText.From(new TestStream(canRead: true, canSeek: false), Encoding.UTF8));
Text\TextChangeTests.cs (1)
104Assert.Throws<ArgumentException>(() => text.WithChanges(changes));
Text\TextLineCollectionTests.cs (2)
19Assert.Throws<NotSupportedException>(() => default(TextLineCollection.Enumerator).Equals(default(TextLineCollection.Enumerator))); 20Assert.Throws<NotSupportedException>(() => default(TextLineCollection.Enumerator).GetHashCode());
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (5)
CodeGen\CodeGenTuples.vb (5)
6868Dim ex = Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create("Item1"))) 6873ex = Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(vt2, elementLocations:=ImmutableArray.Create(loc1))) 7194Dim ex = Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create("123", ""))) 7210Dim ex = Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(csType, Nothing)) 8937Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(underlyingType:=vt2))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (25)
Syntax\SeparatedSyntaxListTests.vb (24)
138Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(-1, nodeD)) 139Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(list.Count + 1, nodeD)) 140Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(-1, {nodeD})) 141Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(list.Count + 1, {nodeD})) 142Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(-1)) 143Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(list.Count)) 144Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Replace(nodeD, nodeE)) 145Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.ReplaceRange(nodeD, {nodeE})) 146Assert.Throws(Of ArgumentNullException)(Function() list.Add(Nothing)) 147Assert.Throws(Of ArgumentNullException)(Function() list.AddRange(DirectCast(Nothing, IEnumerable(Of SyntaxNode)))) 148Assert.Throws(Of ArgumentNullException)(Function() list.Insert(0, Nothing)) 149Assert.Throws(Of ArgumentNullException)(Function() list.InsertRange(0, DirectCast(Nothing, IEnumerable(Of SyntaxNode)))) 150Assert.Throws(Of ArgumentNullException)(Function() list.ReplaceRange(elementA, DirectCast(Nothing, IEnumerable(Of SyntaxNode)))) 185Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.RemoveAt(0)) 186Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(1, nodeD)) 187Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Insert(-1, nodeD)) 188Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(1, {nodeD})) 189Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.InsertRange(-1, {nodeD})) 190Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.Replace(nodeD, nodeE)) 191Assert.Throws(Of ArgumentOutOfRangeException)(Function() list.ReplaceRange(nodeD, {nodeE})) 192Assert.Throws(Of ArgumentNullException)(Function() list.Add(Nothing)) 193Assert.Throws(Of ArgumentNullException)(Function() list.AddRange(DirectCast(Nothing, IEnumerable(Of SyntaxNode)))) 194Assert.Throws(Of ArgumentNullException)(Function() list.Insert(0, Nothing)) 195Assert.Throws(Of ArgumentNullException)(Function() list.InsertRange(0, DirectCast(Nothing, IEnumerable(Of SyntaxNode))))
Syntax\SyntaxTokenFactoryTests.vb (1)
135Assert.Throws(Of ArgumentOutOfRangeException)(Function() SyntaxFactory.Token(CType(localKind, SyntaxKind)))
Microsoft.CodeAnalysis.Workspaces.UnitTests (102)
Options\OptionKeyTests.cs (9)
23Assert.Throws<ArgumentNullException>(() => new Option<bool>("Test Feature", null!, false)); 24Assert.Throws<ArgumentNullException>(() => new Option<bool>(null!, "Test Name", false)); 25Assert.Throws<ArgumentNullException>(() => new Option<bool>("X", "Test Name", false, storageLocations: null!)); 32Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>("Test Feature", null!, false)); 33Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>(null!, "Test Name", false)); 34Assert.Throws<ArgumentNullException>(() => new PerLanguageOption<bool>("X", "Test Name", false, storageLocations: null!)); 70Assert.Throws<ArgumentNullException>(() => new OptionKey(null!)); 71Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, null!)); 72Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, "lang"));
Remote\ServiceDescriptorTests.cs (1)
194Assert.Throws<NotImplementedException>(() => original.GetBytes("\u1234"));
SolutionTests\DocumentInfoTests.cs (2)
24Assert.Throws<ArgumentNullException>(() => DocumentInfo.Create(id: null, "doc")); 25Assert.Throws<ArgumentNullException>(() => DocumentInfo.Create(documentId, name: null));
SolutionTests\ProjectInfoTests.cs (4)
25Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(id: null, version: VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: "C#")); 26Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: null, assemblyName: "Bar", language: "C#")); 27Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: null, language: "C#")); 28Assert.Throws<ArgumentNullException>(() => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: null));
SolutionTests\SolutionInfoTests.cs (1)
23Assert.Throws<ArgumentNullException>(() => SolutionInfo.Create(null, version));
SolutionTests\SolutionTestHelpers.cs (3)
38Assert.Throws<ArgumentNullException>(() => factory(instance, default)); 71Assert.Throws<ArgumentNullException>(() => factory(instanceWithNoItem, new TValue[] { item, default })); 81Assert.Throws<ArgumentException>(() => factory(instanceWithNoItem, new TValue[] { item, item }));
SolutionTests\SolutionTests.cs (71)
118Assert.Throws<ArgumentNullException>(() => solution.RemoveDocument(null!)); 119Assert.Throws<InvalidOperationException>(() => solution.RemoveDocument(s_unrelatedDocumentId)); 127Assert.Throws<ArgumentNullException>(() => solution.RemoveDocuments(default)); 128Assert.Throws<InvalidOperationException>(() => solution.RemoveDocuments(ImmutableArray.Create(s_unrelatedDocumentId))); 129Assert.Throws<ArgumentNullException>(() => solution.RemoveDocuments(ImmutableArray.Create((DocumentId)null!))); 137Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocument(null!)); 138Assert.Throws<InvalidOperationException>(() => solution.RemoveAdditionalDocument(s_unrelatedDocumentId)); 146Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocuments(default)); 147Assert.Throws<InvalidOperationException>(() => solution.RemoveAdditionalDocuments(ImmutableArray.Create(s_unrelatedDocumentId))); 148Assert.Throws<ArgumentNullException>(() => solution.RemoveAdditionalDocuments(ImmutableArray.Create((DocumentId)null!))); 156Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocument(null!)); 157Assert.Throws<InvalidOperationException>(() => solution.RemoveAnalyzerConfigDocument(s_unrelatedDocumentId)); 165Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocuments(default)); 166Assert.Throws<InvalidOperationException>(() => solution.RemoveAnalyzerConfigDocuments(ImmutableArray.Create(s_unrelatedDocumentId))); 167Assert.Throws<ArgumentNullException>(() => solution.RemoveAnalyzerConfigDocuments(ImmutableArray.Create((DocumentId)null!))); 184Assert.Throws<ArgumentNullException>(() => solution.WithDocumentName(documentId, name: null!)); 186Assert.Throws<ArgumentNullException>(() => solution.WithDocumentName(null!, name)); 187Assert.Throws<InvalidOperationException>(() => solution.WithDocumentName(s_unrelatedDocumentId, name)); 216Assert.Throws<ArgumentNullException>(() => solution.WithDocumentFolders(null!, folders)); 217Assert.Throws<InvalidOperationException>(() => solution.WithDocumentFolders(s_unrelatedDocumentId, folders)); 244Assert.Throws<ArgumentNullException>(() => solution.WithDocumentFilePath(null!, path)); 245Assert.Throws<InvalidOperationException>(() => solution.WithDocumentFilePath(s_unrelatedDocumentId, path)); 260Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentSourceCodeKind(documentId, (SourceCodeKind)(-1))); 262Assert.Throws<ArgumentNullException>(() => solution.WithDocumentSourceCodeKind(null!, SourceCodeKind.Script)); 263Assert.Throws<InvalidOperationException>(() => solution.WithDocumentSourceCodeKind(s_unrelatedDocumentId, SourceCodeKind.Script)); 319Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentSyntaxRoot(documentId, root, (PreservationMode)(-1))); 321Assert.Throws<ArgumentNullException>(() => solution.WithDocumentSyntaxRoot(null!, root)); 322Assert.Throws<InvalidOperationException>(() => solution.WithDocumentSyntaxRoot(s_unrelatedDocumentId, root)); 340Assert.Throws<ArgumentException>(() => provider.TryGetDiagnosticValue(tree, "CA1234", CancellationToken.None, out _)); 361Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 362Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentText(documentId, text, (PreservationMode)(-1))); 364Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 365Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 385Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 386Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentText(documentId, textAndVersion, (PreservationMode)(-1))); 388Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 389Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 929Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 930Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithAdditionalDocumentText(documentId, text, (PreservationMode)(-1))); 932Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 933Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 953Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 954Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithAdditionalDocumentText(documentId, textAndVersion, (PreservationMode)(-1))); 956Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 957Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 978Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 979Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 1002Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 1003Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 1021Assert.Throws<ArgumentNullException>(() => solution.WithDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity)); 1043Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity)); 1451Assert.Throws<InvalidOperationException>(() => solution.WithProjectAssemblyName(ProjectId.CreateNewId(), "x.dll")); 1475Assert.Throws<InvalidOperationException>(() => solution.WithProjectOutputFilePath(ProjectId.CreateNewId(), "x.dll")); 1529Assert.Throws<InvalidOperationException>(() => solution.WithProjectOutputRefFilePath(ProjectId.CreateNewId(), "x.dll")); 1552Assert.Throws<InvalidOperationException>(() => solution.WithProjectCompilationOutputInfo(ProjectId.CreateNewId(), info)); 1575Assert.Throws<InvalidOperationException>(() => solution.WithProjectDefaultNamespace(ProjectId.CreateNewId(), "x")); 1689Assert.Throws<InvalidOperationException>(() => solution.WithProjectName(ProjectId.CreateNewId(), "x")); 1712Assert.Throws<InvalidOperationException>(() => solution.WithProjectFilePath(ProjectId.CreateNewId(), "x")); 1728Assert.Throws<InvalidOperationException>(() => solution.WithProjectCompilationOptions(ProjectId.CreateNewId(), options)); 1777Assert.Throws<InvalidOperationException>(() => solution.WithProjectParseOptions(ProjectId.CreateNewId(), options)); 2032Assert.Throws<InvalidOperationException>(() => solution.RemoveProjectReference(ProjectId.CreateNewId(), projectRef2)); 2135Assert.Throws<InvalidOperationException>(() => solution.RemoveMetadataReference(projectId, new TestMetadataReference())); 2138Assert.Throws<InvalidOperationException>(() => solution.RemoveMetadataReference(ProjectId.CreateNewId(), metadataRef1)); 2409Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", "text")); 2437Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", sourceText)); 2466Assert.Throws<InvalidOperationException>(() => solution.AddDocument(documentId: DocumentId.CreateNewId(ProjectId.CreateNewId()), "name", syntaxRoot: root)); 2740Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveDocuments(ImmutableArray.Create(documentInfo1.Id))); 2759Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveAdditionalDocuments(ImmutableArray.Create(documentInfo1.Id))); 2778Assert.Throws<ArgumentException>(() => solution.GetProject(projectId2).RemoveAnalyzerConfigDocuments(ImmutableArray.Create(documentInfo1.Id))); 4661Assert.Throws<ArgumentException>(() => solution = solution.WithProjectDocumentsOrder(pid, ImmutableList.Create<DocumentId>())); 4662Assert.Throws<ArgumentNullException>(() => solution = solution.WithProjectDocumentsOrder(pid, null));
SolutionTests\TryApplyChangesTests.cs (1)
105var exception = Assert.Throws<NotSupportedException>(
UtilityTest\SpecializedTasksTests.cs (6)
118var exception = Assert.Throws<TaskCanceledException>(() => task.Result); 195var exception = Assert.Throws<TaskCanceledException>(() => task.Result); 252var exception = Assert.Throws<TaskCanceledException>(() => task.Result); 319var exception = Assert.Throws<TaskCanceledException>(() => task.Result); 400var exception = Assert.Throws<InvalidOperationException>(() => task.Result); 480var exception = Assert.Throws<TaskCanceledException>(() => task.Result);
WorkspaceTests\WorkspaceTests.cs (4)
30Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 46Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 81Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 97Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message);
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (1)
ExampleTests.cs (1)
21var ex = Assert.Throws<InvalidOperationException>(() => TestExampleLanguageServer.CreateBadLanguageServer(logger));
Microsoft.Data.Analysis.Tests (141)
DataFrame.IOTests.cs (4)
231Assert.Throws<System.ArgumentException>(() => DataFrame.LoadCsv(GetStream(data))); 751Assert.Throws<IndexOutOfRangeException>(() => DataFrame.LoadCsv(GetStream(data))); 752Assert.Throws<IndexOutOfRangeException>(() => DataFrame.LoadCsvFromString(data)); 1695Assert.Throws<FormatException>(() => DataFrame.LoadCsvFromString(csvString));
DataFrameGroupByTests.cs (1)
106Assert.Throws<InvalidCastException>(() => df.GroupBy<double>("Tens"));
DataFrameTests.BinaryOperations.cs (10)
162Assert.Throws<NotSupportedException>(() => df.Add(true)); 167Assert.Throws<NotSupportedException>(() => df.And(true)); 180Assert.Throws<NotSupportedException>(() => df.Add(5)); 182Assert.Throws<NotSupportedException>(() => df.LeftShift(5)); 214Assert.Throws<NotSupportedException>(() => df.Add(5)); 216Assert.Throws<NotSupportedException>(() => df.LeftShift(5)); 218Assert.Throws<NotSupportedException>(() => df.RightShift(5)); 221Assert.Throws<NotSupportedException>(() => df.And(true)); 223Assert.Throws<NotSupportedException>(() => df.Or(true)); 225Assert.Throws<NotSupportedException>(() => df.Xor(true));
DataFrameTests.Computations.cs (92)
31Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].All()); 32Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].Any()); 33Assert.Throws<NotSupportedException>(() => df.Columns["Char"].All()); 34Assert.Throws<NotSupportedException>(() => df.Columns["Char"].Any()); 35Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].All()); 36Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].Any()); 37Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].All()); 38Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].Any()); 39Assert.Throws<NotSupportedException>(() => df.Columns["Double"].All()); 40Assert.Throws<NotSupportedException>(() => df.Columns["Double"].Any()); 41Assert.Throws<NotSupportedException>(() => df.Columns["Float"].All()); 42Assert.Throws<NotSupportedException>(() => df.Columns["Float"].Any()); 43Assert.Throws<NotSupportedException>(() => df.Columns["Int"].All()); 44Assert.Throws<NotSupportedException>(() => df.Columns["Int"].Any()); 45Assert.Throws<NotSupportedException>(() => df.Columns["Long"].All()); 46Assert.Throws<NotSupportedException>(() => df.Columns["Long"].Any()); 47Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].All()); 48Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].Any()); 49Assert.Throws<NotSupportedException>(() => df.Columns["Short"].All()); 50Assert.Throws<NotSupportedException>(() => df.Columns["Short"].Any()); 51Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].All()); 52Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].Any()); 53Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].All()); 54Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].Any()); 55Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].All()); 56Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].Any()); 133Assert.Throws<NotSupportedException>(() => column.CumulativeMax()); 134Assert.Throws<NotSupportedException>(() => column.CumulativeMin()); 135Assert.Throws<NotSupportedException>(() => column.CumulativeProduct()); 136Assert.Throws<NotSupportedException>(() => column.CumulativeSum()); 137Assert.Throws<NotSupportedException>(() => column.Max()); 138Assert.Throws<NotSupportedException>(() => column.Min()); 139Assert.Throws<NotSupportedException>(() => column.Product()); 140Assert.Throws<NotSupportedException>(() => column.Sum()); 145Assert.Throws<NotImplementedException>(() => column.CumulativeMax()); 146Assert.Throws<NotImplementedException>(() => column.CumulativeMin()); 147Assert.Throws<NotImplementedException>(() => column.CumulativeProduct()); 148Assert.Throws<NotImplementedException>(() => column.CumulativeSum()); 149Assert.Throws<NotImplementedException>(() => column.Max()); 150Assert.Throws<NotImplementedException>(() => column.Min()); 151Assert.Throws<NotImplementedException>(() => column.Product()); 152Assert.Throws<NotImplementedException>(() => column.Sum()); 162Assert.Throws<NotSupportedException>(() => column.CumulativeProduct()); 163Assert.Throws<NotSupportedException>(() => column.CumulativeSum()); 164Assert.Throws<NotSupportedException>(() => column.Product()); 165Assert.Throws<NotSupportedException>(() => column.Sum()); 193Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].All()); 194Assert.Throws<NotSupportedException>(() => df.Columns["Byte"].Any()); 195Assert.Throws<NotSupportedException>(() => df.Columns["Char"].All()); 196Assert.Throws<NotSupportedException>(() => df.Columns["Char"].Any()); 197Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].All()); 198Assert.Throws<NotSupportedException>(() => df.Columns["Decimal"].Any()); 199Assert.Throws<NotSupportedException>(() => df.Columns["Double"].All()); 200Assert.Throws<NotSupportedException>(() => df.Columns["Double"].Any()); 201Assert.Throws<NotSupportedException>(() => df.Columns["Float"].All()); 202Assert.Throws<NotSupportedException>(() => df.Columns["Float"].Any()); 203Assert.Throws<NotSupportedException>(() => df.Columns["Int"].All()); 204Assert.Throws<NotSupportedException>(() => df.Columns["Int"].Any()); 205Assert.Throws<NotSupportedException>(() => df.Columns["Long"].All()); 206Assert.Throws<NotSupportedException>(() => df.Columns["Long"].Any()); 207Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].All()); 208Assert.Throws<NotSupportedException>(() => df.Columns["Sbyte"].Any()); 209Assert.Throws<NotSupportedException>(() => df.Columns["Short"].All()); 210Assert.Throws<NotSupportedException>(() => df.Columns["Short"].Any()); 211Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].All()); 212Assert.Throws<NotSupportedException>(() => df.Columns["Uint"].Any()); 213Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].All()); 214Assert.Throws<NotSupportedException>(() => df.Columns["Ulong"].Any()); 215Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].All()); 216Assert.Throws<NotSupportedException>(() => df.Columns["Ushort"].Any()); 217Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].All()); 218Assert.Throws<NotSupportedException>(() => df.Columns["DateTime"].Any()); 302Assert.Throws<NotSupportedException>(() => column.CumulativeMax()); 303Assert.Throws<NotSupportedException>(() => column.CumulativeMin()); 304Assert.Throws<NotSupportedException>(() => column.CumulativeProduct()); 305Assert.Throws<NotSupportedException>(() => column.CumulativeSum()); 306Assert.Throws<NotSupportedException>(() => column.Max()); 307Assert.Throws<NotSupportedException>(() => column.Min()); 308Assert.Throws<NotSupportedException>(() => column.Product()); 309Assert.Throws<NotSupportedException>(() => column.Sum()); 314Assert.Throws<NotImplementedException>(() => column.CumulativeMax()); 315Assert.Throws<NotImplementedException>(() => column.CumulativeMin()); 316Assert.Throws<NotImplementedException>(() => column.CumulativeProduct()); 317Assert.Throws<NotImplementedException>(() => column.CumulativeSum()); 318Assert.Throws<NotImplementedException>(() => column.Max()); 319Assert.Throws<NotImplementedException>(() => column.Min()); 320Assert.Throws<NotImplementedException>(() => column.Product()); 321Assert.Throws<NotImplementedException>(() => column.Sum()); 326Assert.Throws<NotSupportedException>(() => column.CumulativeProduct()); 327Assert.Throws<NotSupportedException>(() => column.CumulativeSum()); 328Assert.Throws<NotSupportedException>(() => column.Product()); 329Assert.Throws<NotSupportedException>(() => column.Sum());
DataFrameTests.cs (25)
44Assert.Throws<ArgumentException>(() => dataFrame["Int5"]); 45Assert.Throws<ArgumentException>(() => dataFrame[(string)null]); 97Assert.Throws<ArgumentException>(() => dataFrame.Columns[1] = intColumnCopy); 191Assert.Throws<ArgumentException>(() => dataframe["City"]); 210Assert.Throws<ArgumentException>(() => dataframe["City"]); 720Assert.Throws<ArgumentException>(() => df.Sample(13)); 1171Assert.Throws<FormatException>(() => df.Append(new List<object> { 5, "str" }, inPlace: true)); 1172Assert.Throws<FormatException>(() => df.Append(new Dictionary<string, object> { { "Column2", "str" } }, inPlace: true)); 1173Assert.Throws<ArgumentException>(() => df.Append(new List<object> { 5, true, true }, inPlace: true)); 1282Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetPrimitiveColumn<float>("Int")); 1286Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetStringColumn("ArrowString")); 1290Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetArrowStringColumn("String")); 1294Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Byte")); 1298Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Int")); 1302Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Bool")); 1306Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Char")); 1310Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Decimal")); 1314Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Double")); 1318Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetDoubleColumn("Float")); 1322Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Long")); 1326Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Sbyte")); 1330Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Short")); 1334Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Uint")); 1338Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Ulong")); 1342Assert.Throws<ArgumentException>(() => dataFrame.Columns.GetSingleColumn("Ushort"));
PrimitiveDataFrameColumnTests.cs (1)
470Assert.Throws<IndexOutOfRangeException>(() => column.Clone(indicesMap));
TextFieldParserTests.cs (8)
36Assert.Throws<ObjectDisposedException>(() => stream.ReadByte()); 54Assert.Throws<ObjectDisposedException>(() => reader.ReadToEnd()); 193Assert.Throws<Exception>(() => parser.ReadFields()); 254Assert.Throws<ArgumentException>(() => parser.PeekChars(0)); 291Assert.Throws<InvalidOperationException>(() => parser.ReadFields()); 318Assert.Throws<Exception>(() => parser.ReadFields()); 367Assert.Throws<Exception>(() => parser.ReadFields()); 383Assert.Throws<Exception>(() => parser.ReadFields());
Microsoft.DotNet.XUnitAssert.Tests (7)
ExceptionAssertsTests.cs (7)
244 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Func<object>)!)); 252 var ex = Record.Exception(() => Assert.Throws<Exception>(testCode)); 263 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 279 Assert.Throws<ArgumentException>(testCode); 288 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 306 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 413 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Func<object>)!));
Microsoft.Extensions.AmbientMetadata.Application.Tests (7)
ApplicationMetadataExtensionsTests.cs (7)
38Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddApplicationMetadata(config.GetSection(string.Empty))); 39Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddApplicationMetadata(_ => { })); 40Assert.Throws<ArgumentNullException>(() => serviceCollection.AddApplicationMetadata((Action<ApplicationMetadata>)null!)); 41Assert.Throws<ArgumentNullException>(() => serviceCollection.AddApplicationMetadata((IConfigurationSection)null!)); 42Assert.Throws<ArgumentNullException>(() => ((IHostBuilder)null!).UseApplicationMetadata(_fixture.Create<string>())); 43Assert.Throws<ArgumentNullException>(() => new ConfigurationBuilder().AddApplicationMetadata(null!)); 44Assert.Throws<ArgumentNullException>(() => ((IConfigurationBuilder)null!).AddApplicationMetadata(null!));
Microsoft.Extensions.AsyncState.Tests (1)
AsyncContextServiceCollectionExtensionsTests.cs (1)
16Assert.Throws<ArgumentNullException>(() => AsyncStateExtensions.AddAsyncState(null!));
Microsoft.Extensions.Caching.Hybrid.Tests (2)
StampedeTests.cs (2)
207var ex = Assert.Throws<OperationCanceledException>(() => result.GetAwaiter().GetResult()); 290var ex = Assert.Throws<OperationCanceledException>(() => result.GetAwaiter().GetResult());
Microsoft.Extensions.Compliance.Abstractions.Tests (3)
Redaction\NullRedactorTest.cs (1)
44Assert.Throws<ArgumentException>(() => r.Redact("ABCD".AsSpan(), new char[1].AsSpan()));
Redaction\RedactionAbstractionsExtensionsTest.cs (2)
17Assert.Throws<ArgumentNullException>(() => RedactionStringBuilderExtensions.AppendRedacted(null!, NullRedactor.Instance, s)); 18Assert.Throws<ArgumentNullException>(() => RedactionStringBuilderExtensions.AppendRedacted(new StringBuilder(), null!, ""));
Microsoft.Extensions.Compliance.Redaction.Tests (3)
HmacRedactorTest.cs (1)
87Assert.Throws<ArgumentException>(() => new HmacRedactor(Microsoft.Extensions.Options.Options.Create<HmacRedactorOptions>(null!)));
RedactionAcceptanceTests.cs (2)
56Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddRedaction(_ => { })); 57Assert.Throws<ArgumentNullException>(() => new ServiceCollection().AddRedaction(null!));
Microsoft.Extensions.Compliance.Testing.Tests (12)
FakeRedactorTests.cs (1)
36Assert.Throws<ArgumentException>(() => FakeRedactor.Create(new FakeRedactorOptions { RedactionFormat = "{{{{{23123{}}" }));
RedactionFakesAcceptanceTests.cs (8)
231Assert.Throws<ArgumentNullException>(() => ((IRedactionBuilder)null!).SetFakeRedactor(dc)); 232Assert.Throws<ArgumentNullException>(() => ((IRedactionBuilder)null!).SetFakeRedactor(Setup.GetFakesConfiguration(), dc)); 233Assert.Throws<ArgumentNullException>(() => ((IRedactionBuilder)null!).SetFakeRedactor(x => x.RedactionFormat = "2", dc)); 234Assert.Throws<ArgumentNullException>(() => new ServiceCollection().AddRedaction(x => x.SetFakeRedactor((Action<FakeRedactorOptions>)null!, dc))); 236Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddRedaction(x => x.SetFakeRedactor((Action<FakeRedactorOptions>)null!, dc))); 237Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddFakeRedaction()); 238Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddFakeRedaction(_ => { })); 239Assert.Throws<ArgumentNullException>(() => new ServiceCollection().AddFakeRedaction(null!));
RedactionFakesEventCollectorTests.cs (3)
18Assert.Throws<InvalidOperationException>(() => c.LastRedactorRequested); 19Assert.Throws<InvalidOperationException>(() => c.LastRedactedData); 27Assert.Throws<InvalidOperationException>(() => sp.GetFakeRedactionCollector());
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
KeyPerFileTests.cs (1)
35var e = Assert.Throws<ArgumentException>(() => new ConfigurationBuilder().AddKeyPerFile("nonexistent", false).Build());
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (4)
ApplicationLifecycleHealthChecksExtensionsTests.cs (2)
49Assert.Throws<ArgumentNullException>(() => ((IHealthChecksBuilder)null!).AddApplicationLifecycleHealthCheck()); 50Assert.Throws<ArgumentNullException>(() => ((IHealthChecksBuilder)null!).AddApplicationLifecycleHealthCheck(null!));
ManualHealthCheckExtensionsTests.cs (2)
44Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddHealthChecks().AddManualHealthCheck()); 45Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddHealthChecks().AddManualHealthCheck(null!));
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (9)
ResourceMonitoringExtensionsTests.cs (4)
25Assert.Throws<ArgumentNullException>(() => ((IResourceMonitorBuilder)null!).ConfigureMonitor(_ => { })); 26Assert.Throws<ArgumentNullException>(() => ((IResourceMonitorBuilder)null!).ConfigureMonitor((IConfigurationSection)null!)); 27Assert.Throws<ArgumentNullException>(() => services.AddResourceMonitoring((b) => b.ConfigureMonitor((IConfigurationSection)null!))); 28Assert.Throws<ArgumentNullException>(() => services.AddResourceMonitoring((b) => b.ConfigureMonitor((Action<ResourceMonitoringOptions>)null!)));
ResourceUtilizationTests.cs (1)
33Assert.Throws<ArgumentOutOfRangeException>(() => new ResourceUtilization(-50.0, 500, _systemResources));
SystemResourcesTests.cs (4)
29Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(0.0, 1.0, 1000UL, 1000UL)); 31Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 0.0, 1000UL, 1000UL)); 34Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 1.0, 0UL, 1000UL)); 36Assert.Throws<ArgumentOutOfRangeException>(() => new SystemResources(1.0, 1.0, 1000UL, 0UL));
Microsoft.Extensions.Diagnostics.Testing.Tests (16)
Logging\FakeLogCollectorTests.cs (2)
113Assert.Throws<ArgumentNullException>(() => new FakeLogCollector(null!)); 114Assert.Throws<ArgumentException>(() => new FakeLogCollector(Microsoft.Extensions.Options.Options.Create((FakeLogCollectorOptions)null!)));
Logging\FakeLoggerExtensionsTests.cs (1)
85Assert.Throws<InvalidOperationException>(() => serviceProvider.GetFakeLogCollector());
Logging\FakeLoggerTests.cs (1)
64Assert.Throws<InvalidOperationException>(() => logger.LatestRecord.Level);
Metrics\MetricCollectorTests.cs (12)
19Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>((Instrument<long>)null!)); 20Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>((ObservableInstrument<long>)null!)); 21Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(new Meter(Guid.NewGuid().ToString()), null!)); 22Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(null!, "Hello")); 23Assert.Throws<ArgumentNullException>(() => new MetricCollector<long>(null, null!, "Hello")); 25Assert.Throws<ArgumentException>(() => new MetricCollector<long>(new Meter(Guid.NewGuid().ToString()), string.Empty)); 26Assert.Throws<ArgumentException>(() => new MetricCollector<long>(null, string.Empty, "Hello")); 27Assert.Throws<ArgumentException>(() => new MetricCollector<long>(null, "Hello", string.Empty)); 36Assert.Throws<InvalidOperationException>(() => new MetricCollector<Guid>(meter, "Counter")); 37Assert.Throws<InvalidOperationException>(() => new MetricCollector<Guid>(null, meter.Name, "Counter")); 361Assert.Throws<ObjectDisposedException>(() => collector.GetMeasurementSnapshot()); 363Assert.Throws<ObjectDisposedException>(() => collector.LastMeasurement);
Microsoft.Extensions.Features.Tests (2)
FeatureCollectionExtensionsTests.cs (1)
36Assert.Throws<InvalidOperationException>(() => features.GetRequiredFeature<object>());
FeatureCollectionTests.cs (1)
55var ex = Assert.Throws<InvalidOperationException>(() => interfaces.Get<int>());
Microsoft.Extensions.FileProviders.Embedded.Tests (1)
EmbeddedFileProviderTests.cs (1)
19Assert.Throws<ArgumentNullException>(() => new EmbeddedFileProvider(null));
Microsoft.Extensions.Hosting.Testing.Tests (3)
FakeHostTests.cs (1)
36Assert.Throws<ObjectDisposedException>(() => host.Services.GetService<IHost>());
HostingFakesExtensionsTests.cs (2)
301Assert.Throws<ArgumentNullException>(() => FakeHost.CreateBuilder().AddFakeLoggingOutputSink(null!)); 307Assert.Throws<ArgumentNullException>(() => ((IHostBuilder)null!).AddFakeLoggingOutputSink(_ => { }));
Microsoft.Extensions.Http.Resilience.Tests (17)
Hedging\StandardHedgingTests.cs (5)
49Assert.Throws<OptionsValidationException>(CreateClientWithHandler); 57Assert.Throws<OptionsValidationException>(CreateClientWithHandler); 139Assert.Throws<InvalidOperationException>(() => 157Assert.Throws<ArgumentException>(() => 166Assert.Throws<ArgumentException>(() =>
Resilience\HttpClientBuilderExtensionsTests.BySelector.cs (1)
55Assert.Throws<InvalidOperationException>(() => provider(request));
Resilience\HttpClientBuilderExtensionsTests.Resilience.cs (8)
31Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler(null!, _ => { })); 32Assert.Throws<ArgumentException>(() => builder.AddResilienceHandler(string.Empty, _ => { })); 33Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler(null!, (_, _) => { })); 34Assert.Throws<ArgumentException>(() => builder.AddResilienceHandler(string.Empty, (_, _) => { })); 35Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler("dummy", (Action<ResiliencePipelineBuilder<HttpResponseMessage>>)null!)); 36Assert.Throws<ArgumentNullException>(() => builder.AddResilienceHandler("dummy", (Action<ResiliencePipelineBuilder<HttpResponseMessage>, ResilienceHandlerContext>)null!)); 39Assert.Throws<ArgumentNullException>(() => builder!.AddResilienceHandler("pipeline-name", _ => { })); 40Assert.Throws<ArgumentNullException>(() => builder!.AddResilienceHandler("pipeline-name", (_, _) => { }));
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (2)
150Assert.Throws<InvalidOperationException>(() => HttpClientBuilderExtensionsTests.GetPipeline(builder.Services, "test-standard")); 197Assert.Throws<OptionsValidationException>(() => GetPipeline(builder.Services, "test-standard"));
Resilience\HttpResilienceContextExtensionsTests.cs (1)
18Assert.Throws<ArgumentNullException>(context.GetRequestMessage);
Microsoft.Extensions.Localization.Tests (4)
ResourceManagerStringLocalizerFactoryTest.cs (1)
297Assert.Throws<ArgumentNullException>(() => factory.Create("baseName", location: null!));
StringLocalizerOfTTest.cs (3)
16var exception = Assert.Throws<ArgumentNullException>( 47var exception = Assert.Throws<ArgumentNullException>(() => localizer[name: null!]); 82var exception = Assert.Throws<ArgumentNullException>(() => localizer[name: null!]);
Microsoft.Extensions.ML.Tests (4)
FileLoaderTests.cs (2)
35Assert.Throws<InvalidOperationException>(() => loaderUnderTest.GetModel()); 36Assert.Throws<InvalidOperationException>(() => loaderUnderTest.GetReloadToken());
UriLoaderTests.cs (2)
35Assert.Throws<InvalidOperationException>(() => loaderUnderTest.GetModel()); 36Assert.Throws<InvalidOperationException>(() => loaderUnderTest.GetReloadToken());
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (5)
DependencyInjectionExtensionsTests.cs (5)
19Assert.Throws<ArgumentNullException>(() => ObjectPoolServiceCollectionExtensions.AddPooled<TestClass>(null!)); 20Assert.Throws<ArgumentNullException>(() => ObjectPoolServiceCollectionExtensions.AddPooled<ITestClass, TestClass>(null!)); 33var exception = Assert.Throws<ArgumentException>( 81Assert.Throws<ArgumentNullException>(() => new ServiceCollection().ConfigurePools(null!)); 217Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ObjectPool<ITestClass>>().Get());
Microsoft.Extensions.ObjectPool.Tests (1)
DisposableObjectPoolTest.cs (1)
107Assert.Throws<ObjectDisposedException>(() => pool.Get());
Microsoft.Extensions.Options.Contextual.Tests (1)
ContextualOptionsServiceCollectionExtensionsTests.cs (1)
20Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null!).AddContextualOptions());
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (6)
DnsServicePublicApiTests.cs (6)
19var exception = Assert.Throws<ArgumentNullException>(action); 31var exception = Assert.Throws<ArgumentNullException>(action); 43var exception = Assert.Throws<ArgumentNullException>(action); 54var exception = Assert.Throws<ArgumentNullException>(action); 66var exception = Assert.Throws<ArgumentNullException>(action); 78var exception = Assert.Throws<ArgumentNullException>(action);
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (3)
YarpServiceDiscoveryPublicApiTests.cs (3)
20var exception = Assert.Throws<ArgumentNullException>(action); 31var exception = Assert.Throws<ArgumentNullException>(action); 42var exception = Assert.Throws<ArgumentNullException>(action);
Microsoft.Extensions.Telemetry.Abstractions.Tests (18)
Enrichment\EnricherExtensionsTests.cs (3)
16Assert.Throws<ArgumentNullException>(() => new ServiceCollection().AddLogEnricher(null!)); 26Assert.Throws<ArgumentNullException>(() => 29Assert.Throws<ArgumentNullException>(() =>
Latency\LatencyRegistryExtensionsTests.cs (9)
16Assert.Throws<ArgumentNullException>( 18Assert.Throws<ArgumentNullException>( 20Assert.Throws<ArgumentNullException>( 22Assert.Throws<ArgumentNullException>( 24Assert.Throws<ArgumentNullException>( 26Assert.Throws<ArgumentNullException>( 33Assert.Throws<ArgumentException>(() => LatencyRegistryServiceCollectionExtensions.RegisterCheckpointNames(new ServiceCollection(), "")); 34Assert.Throws<ArgumentException>(() => LatencyRegistryServiceCollectionExtensions.RegisterMeasureNames(new ServiceCollection(), "")); 35Assert.Throws<ArgumentException>(() => LatencyRegistryServiceCollectionExtensions.RegisterTagNames(new ServiceCollection(), ""));
Latency\NoopLatencyContextTests.cs (1)
15Assert.Throws<ArgumentNullException>(() =>
Logging\TagNameAttributeTests.cs (1)
17Assert.Throws<ArgumentNullException>(() => new TagNameAttribute(null!));
Logging\TagProviderAttributeTests.cs (4)
26Assert.Throws<ArgumentNullException>(() => new TagProviderAttribute(null!, "test")); 27Assert.Throws<ArgumentNullException>(() => new TagProviderAttribute(typeof(object), null!)); 33Assert.Throws<ArgumentException>(() => new TagProviderAttribute(typeof(object), string.Empty)); 34Assert.Throws<ArgumentException>(() => new TagProviderAttribute(typeof(object), new string(' ', 3)));
Microsoft.Extensions.Telemetry.Tests (18)
Enrichment\ApplicationEnricherExtensionsTests.cs (4)
20Assert.Throws<ArgumentNullException>(() => 23Assert.Throws<ArgumentNullException>(() => 26Assert.Throws<ArgumentNullException>(() => 29Assert.Throws<ArgumentNullException>(() =>
Enrichment\ProcessEnricherExtensionsTests.cs (5)
20Assert.Throws<ArgumentNullException>(() => 23Assert.Throws<ArgumentNullException>(() => 26Assert.Throws<ArgumentNullException>(() => 29Assert.Throws<ArgumentNullException>(() => 32Assert.Throws<ArgumentNullException>(() =>
Latency\Internal\LatencyContextProviderTests.cs (3)
87Assert.Throws<ArgumentException>(() => tokenissuer.GetCheckpointToken("ca1")); 88Assert.Throws<ArgumentException>(() => tokenissuer.GetMeasureToken("ma1")); 89Assert.Throws<ArgumentException>(() => tokenissuer.GetTagToken("ta1"));
Latency\LatencyConsoleExtensionsTests.cs (3)
20Assert.Throws<ArgumentNullException>(() => LatencyConsoleExtensions.AddConsoleLatencyDataExporter(null!)); 21Assert.Throws<ArgumentNullException>(() => LatencyConsoleExtensions.AddConsoleLatencyDataExporter(s, configure: null!)); 22Assert.Throws<ArgumentNullException>(() => LatencyConsoleExtensions.AddConsoleLatencyDataExporter(s, section: null!));
Latency\LatencyContextExtensionTests.cs (1)
20Assert.Throws<ArgumentNullException>(() =>
Logging\ExtendedLoggerFactoryTests.cs (2)
41Assert.Throws<ObjectDisposedException>(() => factory.CreateLogger("d")); 237Assert.Throws<ArgumentException>(() =>
Microsoft.JSInterop.Tests (23)
Infrastructure\ByteArrayJsonConverterTest.cs (8)
25var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 38var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 51var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 89var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 121var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 137var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 153var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)); 169var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
Infrastructure\DotNetDispatcherTest.cs (6)
169var ex = Assert.Throws<InvalidOperationException>(() => 238var ex = Assert.Throws<ArgumentException>( 257var ex = Assert.Throws<ArgumentException>( 506var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, 0, default), "[7]")); 521var ex = Assert.Throws<ArgumentException>(() => DotNetDispatcher.Invoke(jsRuntime, new DotNetInvocationInfo(null, methodIdentifier, 1, default), argsJson)); 535Assert.Throws<JsonException>(() =>
Infrastructure\DotNetObjectReferenceJsonConverterTest.cs (2)
23var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)); 37var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions));
Infrastructure\DotNetStreamReferenceJsonConverterTest.cs (1)
26var ex = Assert.Throws<NotSupportedException>(() => JsonSerializer.Deserialize<DotNetStreamReference>(json, JsonSerializerOptions));
Infrastructure\JSObjectReferenceJsonConverterTest.cs (2)
27var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IJSObjectReference>(json, JsonSerializerOptions)); 38var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IJSObjectReference>(json, JsonSerializerOptions));
Infrastructure\JSStreamReferenceJsonConverterTest.cs (3)
27var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IJSStreamReference>(json, JsonSerializerOptions)); 38var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IJSStreamReference>(json, JsonSerializerOptions)); 72var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IJSStreamReference>(json, JsonSerializerOptions));
JSObjectReferenceTest.cs (1)
65Assert.Throws<ObjectDisposedException>(() => jsObject.Invoke<object>("test", "arg1", "arg2"));
Microsoft.ML.AutoML.Tests (1)
ColumnInferenceTests.cs (1)
54Assert.Throws<ArgumentOutOfRangeException>(() => new MLContext(1).Auto().InferColumns(DatasetUtil.GetUciAdultDataset(), 100));
Microsoft.ML.OnnxTransformerTest (1)
OnnxTransformTests.cs (1)
417Assert.Throws<InvalidOperationException>(() => ML.Transforms.ApplyOnnxModel("softmaxout_1", "data_0", modelFile, gpuDeviceId: _gpuDeviceId, fallbackToCpu: _fallbackToCpu));
Microsoft.ML.Tests (23)
AnomalyDetectionTests.cs (1)
50Assert.Throws<ArgumentOutOfRangeException>(() => ML.AnomalyDetection.Evaluate(transformedData));
ImagesTests.cs (16)
1264Assert.Throws<ArgumentNullException>(() => MLImage.CreateFromFile(null)); 1265Assert.Throws<ArgumentException>(() => MLImage.CreateFromFile("This is Invalid Path")); 1266Assert.Throws<ArgumentNullException>(() => MLImage.CreateFromStream(null)); 1267Assert.Throws<ArgumentException>(() => MLImage.CreateFromStream(new MemoryStream(new byte[10]))); 1268Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Unknown, Array.Empty<byte>())); 1269Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Bgra32, Array.Empty<byte>())); 1270Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(0, 10, MLPixelFormat.Bgra32, new byte[10])); 1271Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 0, MLPixelFormat.Bgra32, new byte[10])); 1272Assert.Throws<ArgumentException>(() => MLImage.CreateFromPixels(10, 10, MLPixelFormat.Bgra32, new byte[401])); 1319Assert.Throws<InvalidOperationException>(() => image.Tag); 1320Assert.Throws<InvalidOperationException>(() => image.Tag = "Something"); 1321Assert.Throws<InvalidOperationException>(() => image.Width); 1322Assert.Throws<InvalidOperationException>(() => image.Height); 1323Assert.Throws<InvalidOperationException>(() => image.PixelFormat); 1324Assert.Throws<InvalidOperationException>(() => image.BitsPerPixel); 1325Assert.Throws<InvalidOperationException>(() => image.Pixels[0]);
Scenarios\Api\TestApi.cs (1)
240Assert.Throws<ArgumentOutOfRangeException>(() => idv.Schema[1].Annotations.Schema[kindFloat]);
SvmLightTests.cs (3)
406ex = Assert.Throws<InvalidOperationException>(() => ML.Data.LoadFromSvmLightFile(path)); 443var ex = Assert.Throws<InvalidOperationException>(() => ML.Data.CreateSvmLightLoader()); 445ex = Assert.Throws<InvalidOperationException>(() => ML.Data.CreateSvmLightLoaderWithFeatureNames());
TextLoaderTests.cs (1)
584var ex = Assert.Throws<ArgumentOutOfRangeException>(() => mlContext.Data.LoadFromTextFile<ModelWithoutColumnAttribute>("fakefile.txt"));
Transformers\SelectColumnsTests.cs (1)
125Assert.Throws<ArgumentOutOfRangeException>(() => est.Fit(dataView));
Microsoft.ML.Tokenizers.Tests (11)
LlamaTests.cs (1)
347Assert.Throws<ArgumentNullException>(() => llamaTokenizer.Decode(null!));
TiktokenTests.cs (6)
488Assert.Throws<ArgumentNullException>(() => TiktokenTokenizer.CreateForEncoding(null!)); 489Assert.Throws<ArgumentException>(() => TiktokenTokenizer.CreateForEncoding("r50k_base_")); 490Assert.Throws<ArgumentException>(() => TiktokenTokenizer.CreateForEncoding("p50k_base_")); 491Assert.Throws<ArgumentException>(() => TiktokenTokenizer.CreateForEncoding("p50k_edit_")); 492Assert.Throws<ArgumentException>(() => TiktokenTokenizer.CreateForEncoding("cl100k_base_")); 493Assert.Throws<ArgumentException>(() => TiktokenTokenizer.CreateForEncoding("o200k_base_"));
TokenizerTests.cs (4)
221Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCount(input, maxTokenCount: 0, out _, out _)); 222Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCount(input, maxTokenCount: -1, out _, out _)); 223Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCountFromEnd(input, maxTokenCount: 0, out _, out _)); 224Assert.Throws<ArgumentOutOfRangeException>(() => tokenizer.GetIndexByTokenCountFromEnd(input, maxTokenCount: -1, out _, out _));
Microsoft.Net.Http.Headers.Tests (76)
CacheControlHeaderValueTest.cs (1)
575Assert.Throws<FormatException>(() => CacheControlHeaderValue.Parse(input));
ContentDispositionHeaderValueTest.cs (6)
14Assert.Throws<ArgumentException>(() => new ContentDispositionHeaderValue(null)); 21Assert.Throws<ArgumentException>(() => new ContentDispositionHeaderValue(string.Empty)); 382Assert.Throws<ArgumentOutOfRangeException>(() => contentDisposition.Size = -279172874240); 636Assert.Throws<FormatException>(() => ContentDispositionHeaderValue.Parse(input)); 687Assert.Throws<FormatException>(() => ContentDispositionHeaderValue.Parse(input)); 704Assert.Throws<FormatException>(() => new ContentDispositionHeaderValue(contentDisposition));
ContentRangeHeaderValueTest.cs (16)
11Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(-1)); 30Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(-1, 1)); 31Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(0, -1)); 32Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(2, 1)); 51Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(-1, 1, 2)); 52Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(0, -1, 2)); 53Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(0, 1, -1)); 54Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(2, 1, 3)); 55Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(1, 2, 1)); 56Assert.Throws<ArgumentOutOfRangeException>(() => new ContentRangeHeaderValue(1, 2, 2)); 79Assert.Throws<ArgumentException>(() => range.Unit = null); 80Assert.Throws<ArgumentException>(() => range.Unit = ""); 81Assert.Throws<FormatException>(() => range.Unit = " x"); 82Assert.Throws<FormatException>(() => range.Unit = "x "); 83Assert.Throws<FormatException>(() => range.Unit = "x y"); 172Assert.Throws<FormatException>(() => ContentRangeHeaderValue.Parse(input));
CookieHeaderValueTest.cs (5)
154Assert.Throws<ArgumentNullException>(() => new CookieHeaderValue(null, "value")); 161Assert.Throws<ArgumentException>(() => new CookieHeaderValue(name, "value")); 168Assert.Throws<ArgumentException>(() => new CookieHeaderValue("name", value)); 231Assert.Throws<FormatException>(() => CookieHeaderValue.Parse(value)); 305Assert.Throws<FormatException>(() => CookieHeaderValue.ParseStrictList(input));
EntityTagHeaderValueTest.cs (5)
11Assert.Throws<ArgumentException>(() => new EntityTagHeaderValue(null)); 13Assert.Throws<ArgumentException>(() => new EntityTagHeaderValue(string.Empty)); 442Assert.Throws<FormatException>(() => EntityTagHeaderValue.ParseStrictList(inputs)); 501Assert.Throws<FormatException>(() => EntityTagHeaderValue.Parse(input)); 518Assert.Throws<FormatException>(() => new EntityTagHeaderValue(tag));
HeaderUtilitiesTest.cs (1)
115Assert.Throws<ArgumentOutOfRangeException>(() => HeaderUtilities.FormatNonNegativeInt64(value));
MediaTypeHeaderValueTest.cs (8)
13Assert.Throws<ArgumentException>(() => new MediaTypeHeaderValue(null)); 15Assert.Throws<ArgumentException>(() => new MediaTypeHeaderValue(string.Empty)); 185Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Remove(new NameValueHeaderValue("name"))); 316Assert.Throws<ArgumentOutOfRangeException>(() => new MediaTypeHeaderValue("application/xml", -0.01)); 323Assert.Throws<ArgumentOutOfRangeException>(() => mediaType.Quality = 1.01); 643Assert.Throws<FormatException>(() => MediaTypeHeaderValue.ParseStrictList(inputs)); 928Assert.Throws<FormatException>(() => MediaTypeHeaderValue.Parse(input)); 945Assert.Throws<FormatException>(() => new MediaTypeHeaderValue(mediaType));
NameValueHeaderValueTest.cs (5)
11Assert.Throws<ArgumentException>(() => new NameValueHeaderValue(null)); 13Assert.Throws<ArgumentException>(() => new NameValueHeaderValue(string.Empty)); 512Assert.Throws<FormatException>(() => NameValueHeaderValue.ParseStrictList(inputs)); 658Assert.Throws<FormatException>(() => NameValueHeaderValue.Parse(input)); 681Assert.Throws<FormatException>(() => new NameValueHeaderValue(name, value));
RangeConditionHeaderValueTest.cs (3)
16Assert.Throws<ArgumentNullException>(() => new RangeConditionHeaderValue(input)); 26Assert.Throws<ArgumentException>(() => new RangeConditionHeaderValue((string?)null)); 120Assert.Throws<FormatException>(() => RangeConditionHeaderValue.Parse(input));
RangeHeaderValueTest.cs (7)
11Assert.Throws<ArgumentOutOfRangeException>(() => new RangeHeaderValue(5, 2)); 21Assert.Throws<ArgumentException>(() => range.Unit = null); 22Assert.Throws<ArgumentException>(() => range.Unit = ""); 23Assert.Throws<FormatException>(() => range.Unit = " x"); 24Assert.Throws<FormatException>(() => range.Unit = "x "); 25Assert.Throws<FormatException>(() => range.Unit = "x y"); 160Assert.Throws<FormatException>(() => RangeHeaderValue.Parse(input));
RangeItemHeaderValueTest.cs (4)
11Assert.Throws<ArgumentException>(() => new RangeItemHeaderValue(null, null)); 17Assert.Throws<ArgumentOutOfRangeException>(() => new RangeItemHeaderValue(-1, null)); 23Assert.Throws<ArgumentOutOfRangeException>(() => new RangeItemHeaderValue(2, 1)); 29Assert.Throws<ArgumentOutOfRangeException>(() => new RangeItemHeaderValue(null, -1));
SetCookieHeaderValueTest.cs (5)
300Assert.Throws<ArgumentNullException>(() => new SetCookieHeaderValue(null, "value")); 307Assert.Throws<ArgumentException>(() => new SetCookieHeaderValue(name, "value")); 314Assert.Throws<ArgumentException>(() => new SetCookieHeaderValue("name", value)); 388Assert.Throws<FormatException>(() => SetCookieHeaderValue.Parse(value)); 474Assert.Throws<FormatException>(() => SetCookieHeaderValue.ParseStrictList(input));
StringWithQualityHeaderValueTest.cs (10)
15Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue(null)); 16Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue("")); 17Assert.Throws<FormatException>(() => new StringWithQualityHeaderValue("in valid")); 27Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue(null, 0.1)); 28Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue("", 0.1)); 29Assert.Throws<FormatException>(() => new StringWithQualityHeaderValue("in valid", 0.1)); 31Assert.Throws<ArgumentOutOfRangeException>(() => new StringWithQualityHeaderValue("t", 1.1)); 32Assert.Throws<ArgumentOutOfRangeException>(() => new StringWithQualityHeaderValue("t", -0.1)); 161Assert.Throws<FormatException>(() => StringWithQualityHeaderValue.Parse(input)); 404Assert.Throws<FormatException>(() => StringWithQualityHeaderValue.ParseStrictList(inputs));
Microsoft.VisualBasic.IntegrationTests (2)
InteractionTests.cs (2)
101_ = Assert.Throws<ArgumentNullException>(() => Interaction.Shell(null)).ToString(); 109_ = Assert.Throws<FileNotFoundException>(() => Interaction.Shell(path)).ToString();
Microsoft.VisualBasic.Tests (9)
Microsoft\VisualBasic\ApplicationServices\ApplicationBaseTests.cs (1)
59var ex = Assert.Throws<ArgumentException>(() => app.GetEnvironmentVariable($"{key}z"));
Microsoft\VisualBasic\Devices\MouseTests.cs (3)
28Assert.Throws<InvalidOperationException>(() => mouse.ButtonsSwapped); 46Assert.Throws<InvalidOperationException>(() => mouse.WheelExists); 67Assert.Throws<InvalidOperationException>(() => mouse.WheelScrollLines);
Microsoft\VisualBasic\Devices\NetworkTests.cs (1)
38Assert.Throws<ArgumentNullException>(() => network.Ping((string)null));
Microsoft\VisualBasic\MyServices\FileSystemProxyTests.cs (2)
31Assert.Throws<ArgumentNullException>(() => _fileSystem.CombinePath(null, "Test2")); 32Assert.Throws<ArgumentNullException>(() => _fileSystem.CombinePath("", "Test2"));
Microsoft\VisualBasic\MyServices\Internal\ContextValueTests.cs (1)
12Assert.Throws<NullReferenceException>(() => (new ContextValue<int>()).Value);
Microsoft\VisualBasic\MyServices\RegistryProxyTests.cs (1)
27Assert.Throws<ArgumentException>(() => registry.GetValue(keyName, "", null));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (68)
CodeModel\FileCodeClassTests.cs (11)
108Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributes)); 137Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 155Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 162Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartName)); 180Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartWhole)); 198Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributes)); 227Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 235Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeader)); 242Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 249Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartName)); 267Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartWhole));
CodeModel\FileCodeFunctionTests.cs (13)
271Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributes)); 278Assert.Throws<COMException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 296Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 314Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 321Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartName)); 350Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartWhole)); 368Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributes)); 375Assert.Throws<COMException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 393Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 400Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeader)); 407Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 414Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartName)); 432Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartWhole));
CodeModel\FileCodeImportTests.cs (16)
73Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartAttributes)); 80Assert.Throws<COMException>(() => import.GetStartPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 87Assert.Throws<COMException>(() => import.GetStartPoint(vsCMPart.vsCMPartBody)); 94Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 101Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartHeader)); 108Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 115Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartName)); 132Assert.Throws<NotImplementedException>(() => import.GetStartPoint(vsCMPart.vsCMPartWhole)); 149Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartAttributes)); 156Assert.Throws<COMException>(() => import.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 163Assert.Throws<COMException>(() => import.GetEndPoint(vsCMPart.vsCMPartBody)); 170Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 177Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartHeader)); 184Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 191Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartName)); 209Assert.Throws<NotImplementedException>(() => import.GetEndPoint(vsCMPart.vsCMPartWhole));
CodeModel\FileCodeNamespaceTests.cs (14)
108Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributes)); 115Assert.Throws<COMException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 133Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 140Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeader)); 147Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 154Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartName)); 172Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartWhole)); 189Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributes)); 196Assert.Throws<COMException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributesWithDelimiter)); 214Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 221Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeader)); 228Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 235Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartName)); 253Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartWhole));
CodeModel\FileCodeVariableTests.cs (14)
195Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartAttributes)); 213Assert.Throws<COMException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBody)); 220Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 227Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeader)); 234Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 241Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartName)); 259Assert.Throws<NotImplementedException>(() => testObject.GetStartPoint(vsCMPart.vsCMPartWhole)); 277Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartAttributes)); 295Assert.Throws<COMException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartBody)); 302Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartBodyWithDelimiter)); 309Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeader)); 316Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartHeaderWithAttributes)); 323Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartName)); 341Assert.Throws<NotImplementedException>(() => testObject.GetEndPoint(vsCMPart.vsCMPartWhole));
PresentationCore.Tests (1)
BinaryFormat\DataObjectTests.cs (1)
33Assert.Throws<System.Runtime.InteropServices.COMException>(() => ClipboardDataObject.GetData(DataFormats.Serializable));
Shared.Tests (12)
Data.Validation\LengthAttributeTests.cs (5)
343Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options0, context, results, true)); 348Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options1, context, results, true)); 353Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options2, context, results, true)); 358Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options3, context, results, true)); 363Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options4, context, results, true));
Data.Validation\TimeSpanAttributeTests.cs (3)
230Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options0, context, results, true)); 235Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options1, context, results, true)); 240Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options3, context, results, true));
EmptyCollections\EmptyReadonlyDictionaryTests.cs (2)
46Assert.Throws<KeyNotFoundException>(() => dict[1]); 47Assert.Throws<NotSupportedException>(() => dict[1] = "One");
EmptyCollections\EmptyReadOnlyListTests.cs (2)
48Assert.Throws<InvalidOperationException>(() => enumerator.Current); 49Assert.Throws<InvalidOperationException>(() => ((IEnumerator)enumerator).Current);
Sockets.FunctionalTests (2)
src\Servers\Kestrel\test\FunctionalTests\Http2\HandshakeTests.cs (1)
48var ex = Assert.Throws<NotSupportedException>(() => new TestServer(context =>
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
720Assert.Throws<SocketException>(() => socket.Receive(new byte[32]));
System.Drawing.Common.Tests (243)
mono\System.Drawing\BitmapTests.cs (2)
114Assert.Throws<InvalidOperationException>(() => bmp.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)); 355public void FileDoesNotExists() => Assert.Throws<ArgumentException>(() => new Bitmap("FileDoesNotExists.jpg"));
mono\System.Drawing\GraphicsTests.cs (7)
426Assert.Throws<ArgumentException>(() => g.Transform = matrix); 1596Assert.Throws<ArgumentNullException>(() => g.MeasureString("a", null)); 1597Assert.Throws<ArgumentNullException>(() => g.MeasureString("a".AsSpan(), null)); 1884Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a", null, default, null)); 1885Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a".AsSpan(), null, default, null)); 2000Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono", _font, default, null)); 2001Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono".AsSpan(), _font, default, null));
mono\System.Imaging\MetafileTest.cs (1)
146Assert.Throws<ArgumentException>(() => header.WmfHeader);
System\Drawing\BitmapTests.cs (13)
314Assert.Throws<NullReferenceException>(() => new Bitmap((Image)null)); 440Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(x, y, width, height), bitmap.PixelFormat)); 441Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(x, y, width, height), bitmap.PixelFormat)); 456Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(0, 0, 1, 1), format)); 457Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(0, 0, 1, 1), format)); 464Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new Rectangle(0, 0, 1, 1), PixelFormat.Format32bppArgb)); 465Assert.Throws<OutOfMemoryException>(() => bitmap.Clone(new RectangleF(0, 0, 1, 1), PixelFormat.Format32bppArgb)); 655Assert.Throws<ExternalException>(() => Image.FromHbitmap(IntPtr.Zero)); 1188Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat)); 1189Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat, new BitmapData())); 1191Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat)); 1192Assert.Throws<InvalidOperationException>(() => bitmap.LockBits(new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly, bitmap.PixelFormat, new BitmapData())); 1447Assert.Throws<NullReferenceException>(() => bitmap.Palette = null);
System\Drawing\BufferedGraphicsContextTests.cs (2)
166Assert.Throws<InvalidOperationException>(() => context.Allocate(graphics, largeRectangle)); 167Assert.Throws<InvalidOperationException>(() => context.Allocate(graphics, Rectangle.Empty));
System\Drawing\Drawing2D\BlendTests.cs (2)
29Assert.Throws<OverflowException>(() => new Blend(-1)); 35Assert.Throws<OutOfMemoryException>(() => new Blend(int.MaxValue));
System\Drawing\Drawing2D\ColorBlendTests.cs (2)
29Assert.Throws<OverflowException>(() => new ColorBlend(-1)); 35Assert.Throws<OutOfMemoryException>(() => new ColorBlend(int.MaxValue));
System\Drawing\Drawing2D\CustomLineCapTests.cs (1)
83Assert.Throws<NotImplementedException>(() => new CustomLineCap(fillPath, null));
System\Drawing\Drawing2D\GraphicsPathIteratorTests.cs (2)
293Assert.Throws<ArgumentNullException>(() => gpi.Enumerate(ref points, ref types)); 311Assert.Throws<ArgumentNullException>(() => gpi.CopyData(ref points, ref types, 0, 1));
System\Drawing\Drawing2D\LinearGradientBrushTests.cs (8)
69Assert.Throws<OutOfMemoryException>(() => new LinearGradientBrush(new Point(x, y), new Point(x, y), Color.Fuchsia, Color.GhostWhite)); 70Assert.Throws<OutOfMemoryException>(() => new LinearGradientBrush(new PointF(x, y), new PointF(x, y), Color.Fuchsia, Color.GhostWhite)); 312Assert.Throws<ArgumentNullException>(() => brush.Blend = null); 319Assert.Throws<ArgumentNullException>(() => brush.Blend = new Blend { Factors = null }); 419Assert.Throws<NullReferenceException>(() => brush.InterpolationColors = new ColorBlend { Colors = null }); 437Assert.Throws<ArgumentException>(() => brush.InterpolationColors = new ColorBlend { Colors = new Color[2], Positions = null }); 543Assert.Throws<NullReferenceException>(() => brush.LinearColors = null); 552Assert.Throws<IndexOutOfRangeException>(() => brush.LinearColors = new Color[length]);
System\Drawing\Drawing2D\MatrixTests.cs (4)
147Assert.Throws<OutOfMemoryException>(() => new Matrix(new Rectangle(1, 1, 0, 1), new Point[3])); 148Assert.Throws<OutOfMemoryException>(() => new Matrix(new RectangleF(1, 1, 0, 1), new PointF[3])); 154Assert.Throws<OutOfMemoryException>(() => new Matrix(new Rectangle(1, 1, 1, 0), new Point[3])); 155Assert.Throws<OutOfMemoryException>(() => new Matrix(new RectangleF(1, 1, 1, 0), new PointF[3]));
System\Drawing\Drawing2D\PathGradientBrushTests.cs (12)
78Assert.Throws<ArgumentException>(() => new PathGradientBrush(new Point[pointsLength])); 79Assert.Throws<ArgumentException>(() => new PathGradientBrush(new Point[pointsLength], WrapMode.Clamp)); 80Assert.Throws<ArgumentException>(() => new PathGradientBrush(new PointF[pointsLength])); 81Assert.Throws<ArgumentException>(() => new PathGradientBrush(new PointF[pointsLength], WrapMode.Clamp)); 113Assert.Throws<OutOfMemoryException>(() => new PathGradientBrush(path)); 115Assert.Throws<OutOfMemoryException>(() => new PathGradientBrush(path)); 325Assert.Throws<ArgumentNullException>(() => brush.Blend = null); 326Assert.Throws<ArgumentNullException>(() => brush.Blend = new Blend() { Factors = null, Positions = null }); 575Assert.Throws<ArgumentNullException>(() => brush.InterpolationColors = null); 582Assert.Throws<NullReferenceException>(() => 585Assert.Throws<NullReferenceException>(() => 624Assert.Throws<ArgumentException>(() =>
System\Drawing\FontConverterTests.cs (2)
35Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(null)); 36Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(1));
System\Drawing\FontTests.cs (1)
308Assert.Throws<NullReferenceException>(() => new Font(null, FontStyle.Regular));
System\Drawing\GraphicsTests.Core.cs (2)
30Assert.Throws<InvalidOperationException>(() => graphics.TransformElements); 31Assert.Throws<InvalidOperationException>(() => graphics.TransformElements = Matrix3x2.Identity);
System\Drawing\GraphicsTests.cs (30)
62Assert.Throws<InvalidOperationException>(() => graphics.GetHdc()); 116Assert.Throws<OutOfMemoryException>(() => Graphics.FromHdcInternal(IntPtr.Zero)); 286Assert.Throws<OutOfMemoryException>(() => Graphics.FromImage(image)); 295Assert.Throws<OutOfMemoryException>(() => Graphics.FromImage(image)); 350Assert.Throws<InvalidOperationException>(() => graphics.CompositingMode); 351Assert.Throws<InvalidOperationException>(() => graphics.CompositingMode = CompositingMode.SourceCopy); 434Assert.Throws<InvalidOperationException>(() => graphics.CompositingQuality); 435Assert.Throws<InvalidOperationException>(() => graphics.CompositingQuality = CompositingQuality.AssumeLinear); 488Assert.Throws<InvalidOperationException>(() => graphics.DpiX); 514Assert.Throws<InvalidOperationException>(() => graphics.DpiX); 622Assert.Throws<InvalidOperationException>(() => graphics.InterpolationMode); 623Assert.Throws<InvalidOperationException>(() => graphics.InterpolationMode = InterpolationMode.HighQualityBilinear); 675Assert.Throws<InvalidOperationException>(() => graphics.PageScale); 676Assert.Throws<InvalidOperationException>(() => graphics.PageScale = 10); 736Assert.Throws<InvalidOperationException>(() => graphics.PageUnit); 737Assert.Throws<InvalidOperationException>(() => graphics.PageUnit = GraphicsUnit.Document); 796Assert.Throws<InvalidOperationException>(() => graphics.PixelOffsetMode); 797Assert.Throws<InvalidOperationException>(() => graphics.PixelOffsetMode = PixelOffsetMode.Default); 878Assert.Throws<InvalidOperationException>(() => graphics.RenderingOrigin); 879Assert.Throws<InvalidOperationException>(() => graphics.RenderingOrigin = Point.Empty); 938Assert.Throws<InvalidOperationException>(() => graphics.SmoothingMode); 939Assert.Throws<InvalidOperationException>(() => graphics.SmoothingMode = SmoothingMode.AntiAlias); 988Assert.Throws<InvalidOperationException>(() => graphics.TextContrast); 989Assert.Throws<InvalidOperationException>(() => graphics.TextContrast = 5); 1041Assert.Throws<InvalidOperationException>(() => graphics.TextRenderingHint); 1042Assert.Throws<InvalidOperationException>(() => graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit); 1092Assert.Throws<NullReferenceException>(() => graphics.Transform = null); 1124Assert.Throws<InvalidOperationException>(() => graphics.Transform); 1125Assert.Throws<InvalidOperationException>(() => graphics.Transform = matrix); 1937Assert.Throws<InvalidOperationException>(() => graphics.GetNearestColor(Color.Red));
System\Drawing\IconConverterTests.cs (26)
112Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom("System.Drawing.String")); 113Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 114Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20))); 115Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10))); 116Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10))); 117Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 124Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom("System.Drawing.String")); 125Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 126Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20))); 127Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10))); 128Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10))); 129Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 144Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Rectangle))); 145Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, _icon.GetType())); 146Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Size))); 147Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Point))); 148Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Metafile))); 149Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(object))); 150Assert.Throws<NotSupportedException>(() => _icoConv.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(int))); 161Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Rectangle))); 162Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, _icon.GetType())); 163Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Size))); 164Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Point))); 165Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(Metafile))); 166Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(object))); 167Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _icon, typeof(int)));
System\Drawing\IconTests.cs (8)
260Assert.Throws<NullReferenceException>(() => new Icon(null, "48x48_multiple_entries_4bit.ico")); 307Assert.Throws<ObjectDisposedException>(() => icon.Handle); 316Assert.Throws<ObjectDisposedException>(() => icon.Handle); 394Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("http://microsoft.com")); 413Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("no-such-file.png")); 709Assert.Throws<ObjectDisposedException>(() => icon.Width); 710Assert.Throws<ObjectDisposedException>(() => icon.Height); 711Assert.Throws<ObjectDisposedException>(() => icon.Size);
System\Drawing\ImageConverterTests.cs (28)
139Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom("System.Drawing.String")); 140Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 141Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20))); 142Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10))); 143Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10))); 144Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 146Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom("System.Drawing.String")); 147Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 148Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Bitmap(20, 20))); 149Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new Point(10, 10))); 150Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new SizeF(10, 10))); 151Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 197Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Rectangle))); 198Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, _image.GetType())); 199Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Size))); 200Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Bitmap))); 201Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Point))); 202Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Metafile))); 203Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(object))); 204Assert.Throws<NotSupportedException>(() => _imgConv.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(int))); 206Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Rectangle))); 207Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, _image.GetType())); 208Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Size))); 209Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Bitmap))); 210Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Point))); 211Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(Metafile))); 212Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(object))); 213Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _image, typeof(int)));
System\Drawing\ImageFormatConverterTests.cs (22)
72Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp)); 73Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid)); 74Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 75Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, 10)); 77Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp)); 78Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid)); 79Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, new object())); 80Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, 10)); 118Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("System.Drawing.String")); 119Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 120Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]")); 122Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("System.Drawing.String")); 123Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, "System.Drawing.String")); 124Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]")); 146Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat))); 147Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(Guid))); 148Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(object))); 149Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(int))); 151Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat))); 152Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(Guid))); 153Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(object))); 154Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(int)));
System\Drawing\ImageTests.cs (8)
496Assert.Throws<OutOfMemoryException>(() => Image.FromFile(file.Path)); 497Assert.Throws<OutOfMemoryException>(() => Image.FromFile(file.Path, useEmbeddedColorManagement: true)); 522Assert.Throws<PathTooLongException>(() => Image.FromFile(fileName)); 523Assert.Throws<PathTooLongException>(() => Image.FromFile(fileName, 530Assert.Throws<FileNotFoundException>(() => Image.FromFile(fileName)); 531Assert.Throws<FileNotFoundException>(() => Image.FromFile(fileName, 539Assert.Throws<FileNotFoundException>(() => Image.FromFile("NoSuchFile")); 540Assert.Throws<FileNotFoundException>(() => Image.FromFile("NoSuchFile", useEmbeddedColorManagement: true));
System\Drawing\Imaging\CachedBitmapTests.cs (2)
15Assert.Throws<ArgumentNullException>(() => new CachedBitmap(bitmap, null)); 16Assert.Throws<ArgumentNullException>(() => new CachedBitmap(null, graphics));
System\Drawing\Imaging\EncoderParameterTests.cs (15)
210Assert.Throws<InvalidOperationException>(() => new EncoderParameter(s_anyEncoder, 1, (EncoderParameterValueType)999, IntPtr.Zero)); 229Assert.Throws<NullReferenceException>(() => ep.Encoder = null); 255Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (string)null)); 261Assert.Throws<NullReferenceException>(() => new EncoderParameter(s_anyEncoder, (byte[])null)); 287Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0)); 288Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, false)); 289Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, (short)0)); 290Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, numerator: 0, denominator: 0)); 291Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, rangebegin: 0, rangeend: 0)); 292Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, 0, 0, 0, 0)); 293Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, "anyString")); 294Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<byte>())); 296Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<short>())); 297Assert.Throws<NullReferenceException>(() => new EncoderParameter(null, Array.Empty<long>())); 322Assert.Throws<OutOfMemoryException>(() => new EncoderParameter(s_anyEncoder, numberOfValues, anyType, anyValue));
System\Drawing\Imaging\MetafileTests.cs (16)
47Assert.Throws<ExternalException>(() => new Metafile(metafile.GetHenhmetafile(), false)); 60Assert.Throws<ExternalException>(() => new Metafile(GetPath(BmpFile))); 72Assert.Throws<ExternalException>(() => new Metafile("fileNotExist")); 108Assert.Throws<ExternalException>(() => new Metafile(stream)); 436Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc)); 437Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly)); 438Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly, "description")); 711Assert.Throws<PathTooLongException>(() => new Metafile(fileName, referenceHdc, _rectangleF)); 712Assert.Throws<PathTooLongException>(() => 714Assert.Throws<PathTooLongException>(() => 716Assert.Throws<PathTooLongException>(() => 827Assert.Throws<ArgumentNullException>(() => new Metafile((Stream)null, referenceHdc, _rectangleF)); 828Assert.Throws<ArgumentNullException>(() => new Metafile((Stream)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible)); 829Assert.Throws<ArgumentNullException>(() => 831Assert.Throws<ArgumentNullException>(() => 875Assert.Throws<ArgumentNullException>(() => Metafile.GetMetafileHeader((Stream)null));
System\Drawing\PenTests.cs (3)
325Assert.Throws<ArgumentNullException>(() => pen.CompoundArray = null); 600Assert.Throws<InvalidOperationException>(() => pen.DashPattern); 1214Assert.Throws<InvalidOperationException>(() => pen.DashPattern);
System\Drawing\Printing\MarginsConverterTests.cs (7)
56Assert.Throws<ArgumentException>(() => mc.CreateInstance(context, values)); 109Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, null, null)); 110Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, culture, null)); 111Assert.Throws<NotSupportedException>(() => mc.ConvertFrom(context, culture, Guid.NewGuid())); 139Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, new object(), typeof(object))); 140Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, 12, typeof(int))); 141Assert.Throws<NotSupportedException>(() => mc.ConvertTo(context, culture, guid, typeof(Guid)));
System\Drawing\Printing\PreviewPrintControllerTests.cs (4)
37Assert.Throws<NullReferenceException>(() => controller.OnStartPage(null, e)); 45Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, null)); 56Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, printEventArgs)); 65Assert.Throws<NullReferenceException>(() => controller.OnStartPage(document, e));
System\Drawing\Printing\PrinterSettingsTests.cs (3)
503Assert.Throws<NullReferenceException>(() => printerSettings.CreateMeasurementGraphics(null)); 504Assert.Throws<NullReferenceException>(() => printerSettings.CreateMeasurementGraphics(null, true)); 528Assert.Throws<NullReferenceException>(() => printerSettings.GetHdevmode(null));
System\Drawing\RegionTests.cs (3)
142Assert.Throws<ExternalException>(() => new Region(regionData)); 151Assert.Throws<ExternalException>(() => new Region(regionData)); 160Assert.Throws<NullReferenceException>(() => new Region(regionData));
System\Drawing\SystemIconsTests.cs (1)
52Assert.Throws<ArgumentException>(() => SystemIcons.GetStockIcon((StockIconId)(-1)));
System\Drawing\TextureBrushTests.cs (6)
291Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle)); 292Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle)); 293Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, rectangle)); 294Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, (RectangleF)rectangle)); 295Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle, null)); 296Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle, null));
System.ServiceModel.Http.Tests (30)
Channels\HttpRequestMessagePropertyTest.cs (2)
67Assert.Throws<ArgumentNullException>(() => requestMsgProperty.Method = null); 83Assert.Throws<ArgumentNullException>(() => requestMsgProperty.QueryString = null);
Channels\WebSocketTransportSettingsTest.cs (2)
17Assert.Throws<PlatformNotSupportedException>(() => setting.DisablePayloadMasking = true); 25Assert.Throws<PlatformNotSupportedException>(() => disablePayloadMasking = setting.DisablePayloadMasking);
ServiceModel\BasicHttpBindingTest.cs (11)
119Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferPoolSize = value); 139Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferSize = value); 159Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxReceivedMessageSize = value); 177Assert.Throws<ArgumentException>(() => binding.Name = value); 196Assert.Throws<ArgumentNullException>(() => binding.Namespace = value); 217Assert.Throws<ArgumentNullException>(() => binding.ReaderQuotas = null); 234Assert.Throws<ArgumentOutOfRangeException>(() => binding.CloseTimeout = timeSpan); 251Assert.Throws<ArgumentOutOfRangeException>(() => binding.OpenTimeout = timeSpan); 268Assert.Throws<ArgumentOutOfRangeException>(() => binding.SendTimeout = timeSpan); 285Assert.Throws<ArgumentOutOfRangeException>(() => binding.SendTimeout = timeSpan); 302Assert.Throws<ArgumentException>(() => binding.TextEncoding = encoding);
ServiceModel\BasicHttpsBindingTest.cs (12)
79Assert.Throws<PlatformNotSupportedException>(() => channel.Echo("hello")); 109Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferPoolSize = value); 129Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferSize = value); 149Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxReceivedMessageSize = value); 167Assert.Throws<ArgumentException>(() => binding.Name = value); 186Assert.Throws<ArgumentNullException>(() => binding.Namespace = value); 207Assert.Throws<ArgumentNullException>(() => binding.ReaderQuotas = null); 224Assert.Throws<ArgumentOutOfRangeException>(() => binding.CloseTimeout = timeSpan); 241Assert.Throws<ArgumentOutOfRangeException>(() => binding.OpenTimeout = timeSpan); 258Assert.Throws<ArgumentOutOfRangeException>(() => binding.SendTimeout = timeSpan); 275Assert.Throws<ArgumentOutOfRangeException>(() => binding.SendTimeout = timeSpan); 292Assert.Throws<ArgumentException>(() => binding.TextEncoding = encoding);
ServiceModel\BasicHttpSecurityTest.cs (1)
22Assert.Throws<PlatformNotSupportedException>(() => security.Mode = value);
ServiceModel\HttpIdentityTests.cs (2)
20Assert.Throws<InvalidOperationException>(() => channel.Echo("")); 32Assert.Throws<InvalidOperationException>(() => channel.Echo(""));
System.ServiceModel.NetTcp.Tests (9)
Channels\TcpConnectionPoolSettingsTest.cs (4)
32Assert.Throws<ArgumentNullException>(() => settings.GroupName = null); 53Assert.Throws<ArgumentOutOfRangeException>(() => settings.IdleTimeout = timeSpan); 74Assert.Throws<ArgumentOutOfRangeException>(() => settings.LeaseTimeout = timeSpan); 96Assert.Throws<ArgumentOutOfRangeException>(() => settings.MaxOutboundConnectionsPerEndpoint = value);
ServiceModel\NetTcpBindingTest.cs (3)
68Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferSize = value); 87Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxReceivedMessageSize = value); 103Assert.Throws<ArgumentNullException>(() => binding.Security = null);
ServiceModel\NetTcpSecurityTest.cs (1)
37Assert.Throws<ArgumentOutOfRangeException>(() => security.Mode = (SecurityMode)999);
ServiceModel\TcpTransportSecurityTest.cs (1)
38Assert.Throws<ArgumentOutOfRangeException>(() => transport.ClientCredentialType = (TcpClientCredentialType)999);
System.ServiceModel.Primitives.Tests (27)
Channels\BinaryMessageEncodingBindingElementTest.cs (5)
58Assert.Throws<ArgumentOutOfRangeException>(() => bindingElement.MaxSessionSize = value); 75Assert.Throws<InvalidOperationException>(() => bindingElement.MessageVersion = version); 82Assert.Throws<ArgumentNullException>(() => bindingElement.MessageVersion = null); 109Assert.Throws<ArgumentOutOfRangeException>(() => bindingElement.MaxReadPoolSize = value); 136Assert.Throws<ArgumentOutOfRangeException>(() => bindingElement.MaxWritePoolSize = value);
Channels\CustomChannelTest.cs (2)
468Assert.Throws<InvalidOperationException>(() => factory.CreateChannel()); 722Assert.Throws<InvalidOperationException>(() => channel.Process(inputMessage));
Channels\TextMessageEncodingBindingElementTest.cs (2)
37Assert.Throws<ArgumentException>(() => element.WriteEncoding = encoding); 53Assert.Throws<ArgumentNullException>(() => element.MessageVersion = null);
IdentityModel\SecurityTokenSerializerTest.cs (9)
57Assert.Throws<ArgumentNullException>(() => sts.CanReadKeyIdentifier(null)); 58Assert.Throws<ArgumentNullException>(() => sts.CanReadKeyIdentifierClause(null)); 59Assert.Throws<ArgumentNullException>(() => sts.CanReadToken(null)); 60Assert.Throws<ArgumentNullException>(() => sts.CanWriteKeyIdentifier(null)); 61Assert.Throws<ArgumentNullException>(() => sts.CanWriteKeyIdentifierClause(null)); 62Assert.Throws<ArgumentNullException>(() => sts.CanWriteToken(null)); 63Assert.Throws<ArgumentNullException>(() => sts.ReadToken(null, null)); 64Assert.Throws<ArgumentNullException>(() => sts.ReadKeyIdentifier(null)); 65Assert.Throws<ArgumentNullException>(() => sts.ReadKeyIdentifierClause(null));
Security\SecurityTokenRequirementTest.cs (1)
47Assert.Throws<ArgumentException>(() => tokenrequirement.TryGetProperty(tokenrequirement.TokenType, out int Tvalue));
ServiceModel\ClientBaseTest.cs (6)
46Assert.Throws<InvalidOperationException>(() => MyClientBase.CacheSetting = CacheSetting.AlwaysOn); 67Assert.Throws<InvalidOperationException>(() => MyClientBase.CacheSetting = CacheSetting.AlwaysOn); 96Assert.Throws<InvalidOperationException>(() => MyClientBase2.CacheSetting = CacheSetting.Default); 132Assert.Throws<InvalidOperationException>(() => MyClientBase2.CacheSetting = CacheSetting.Default); 152Assert.Throws<InvalidOperationException>(() => MyClientBase.CacheSetting = CacheSetting.AlwaysOn); 173Assert.Throws<InvalidOperationException>(() => MyClientBase.CacheSetting = CacheSetting.AlwaysOn);
ServiceModel\MessageContractTest.cs (2)
52Assert.Throws<ArgumentOutOfRangeException>(() => messageCA.WrapperName = wrapperName); 60Assert.Throws<ArgumentNullException>(() => messageCA.WrapperName = wrapperName);
System.ServiceModel.UnixDomainSocket.Tests (5)
ServiceModel\UnixDomainSocketBindingTest.cs (3)
69Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxBufferSize = value); 88Assert.Throws<ArgumentOutOfRangeException>(() => binding.MaxReceivedMessageSize = value); 104Assert.Throws<ArgumentNullException>(() => binding.Security = null);
ServiceModel\UnixDomainSocketSecurityTest.cs (1)
37Assert.Throws<ArgumentOutOfRangeException>(() => security.Mode = (UnixDomainSocketSecurityMode)999);
ServiceModel\UnixDomainSocketTransportSecurityTest.cs (1)
40Assert.Throws<ArgumentOutOfRangeException>(() => transport.ClientCredentialType = (UnixDomainSocketClientCredentialType)999);
System.Windows.Forms.Design.Tests (73)
Serialization\TypeCodeDomSerializerTests.cs (4)
21Assert.Throws<ArgumentNullException>(() => underTest.Serialize(null, null, null)); 29Assert.Throws<ArgumentNullException>(() => underTest.Serialize(mockSerializationManager.Object, null, null)); 36Assert.Throws<ArgumentNullException>(() => underTest.Deserialize(null, null)); 44Assert.Throws<ArgumentNullException>(() => underTest.Deserialize(mockSerializationManager.Object, null));
System\ComponentModel\Design\ArrayEditorTests.cs (1)
130TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => editor.GetDisplayText(new ClassWithNonStringDefaultProperty()));
System\ComponentModel\Design\CollectionEditorTests.cs (2)
812TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => editor.GetDisplayText(new ClassWithNonStringDefaultProperty())); 930Assert.Throws<NotSupportedException>(() => editor.SetItems(new object[1], new object[1]));
System\ComponentModel\Design\CollectionFormTests.cs (1)
382Assert.Throws<StackOverflowException>(() => form.Items = value);
System\ComponentModel\Design\ComponentDesignerTests.cs (15)
22Assert.Throws<InvalidOperationException>(() => designer.Component); 26Assert.Throws<InvalidOperationException>(() => designer.ParentComponent); 552Assert.Throws<InvalidOperationException>(() => designer.Component); 557Assert.Throws<InvalidOperationException>(() => designer.Component); 609Assert.Throws<InvalidOperationException>(() => designer.Component); 613Assert.Throws<InvalidOperationException>(() => designer.Component); 621Assert.Throws<InvalidOperationException>(() => designer.Component); 625Assert.Throws<InvalidOperationException>(() => designer.Component); 646Assert.Throws<InvalidOperationException>(() => designer.Component); 659Assert.Throws<InvalidOperationException>(() => designer.Component); 694Assert.Throws<InvalidOperationException>(() => designer.Component); 705Assert.Throws<InvalidOperationException>(() => designer.Component); 719Assert.Throws<InvalidOperationException>(() => designer.Component); 723Assert.Throws<InvalidOperationException>(() => designer.Component); 2014Assert.Throws<InvalidOperationException>(() => designer.Component);
System\ComponentModel\Design\DesignerCommandSetTests.cs (2)
44Assert.Throws<InvalidCastException>(() => mockSet.Object.Verbs); 65Assert.Throws<InvalidCastException>(() => mockSet.Object.ActionLists);
System\ComponentModel\Design\DesignerHostTests.cs (2)
1452Assert.Throws<InvalidOperationException>(() => component1.Site.Name = "name2"); 1453Assert.Throws<InvalidOperationException>(() => component1.Site.Name = "NAME2");
System\ComponentModel\Design\DesignSurfaceTests.cs (14)
32Assert.Throws<InvalidOperationException>(() => surface.View); 71Assert.Throws<InvalidOperationException>(() => surface.View); 178Assert.Throws<ObjectDisposedException>(() => surface.ComponentContainer); 327Assert.Throws<ObjectDisposedException>(() => surface.ServiceContainer); 337Assert.Throws<NotSupportedException>(() => surface.View); 345Assert.Throws<ObjectDisposedException>(() => surface.View); 359Assert.Same(exception, Assert.Throws<InvalidOperationException>(() => surface.View).InnerException); 381Assert.Throws<InvalidOperationException>(() => surface.View); 425Assert.Throws<InvalidOperationException>(() => surface.View); 1017Assert.Throws<ObjectDisposedException>(() => surface.CreateDesigner(new Component(), true)); 1018Assert.Throws<ObjectDisposedException>(() => surface.CreateDesigner(new Component(), false)); 1062Assert.Throws<MissingMethodException>(() => surface.CreateComponent(type)); 1118Assert.Throws<MissingMethodException>(() => surface.CreateInstance(type)); 1162Assert.Throws<ObjectDisposedException>(() => surface.CreateNestedContainer(null, "name"));
System\ComponentModel\Design\ExceptionCollectionTests.cs (1)
41Assert.Throws<ArgumentException>(() => new ExceptionCollection(exceptions));
System\ComponentModel\Design\Serialization\CodeDomComponentSerializationServiceTests.cs (1)
705Assert.Throws<PlatformNotSupportedException>(() => service.LoadStore(null));
System\ComponentModel\Design\Serialization\DesignerSerializationManagerTests.cs (17)
104Assert.Throws<InvalidOperationException>(() => manager.Container = null); 128Assert.Throws<InvalidOperationException>(() => iManager.Context); 136Assert.Throws<InvalidOperationException>(() => iManager.Context); 157Assert.Throws<InvalidOperationException>(() => manager.Errors); 164Assert.Throws<InvalidOperationException>(() => manager.Errors); 192Assert.Throws<InvalidOperationException>(() => manager.PreserveNames = value); 347Assert.Throws<InvalidOperationException>(() => manager.RecycleInstances = value); 376Assert.Throws<InvalidOperationException>(() => manager.ValidateRecycledTypes = value); 462Assert.Throws<InvalidOperationException>(() => iManager.Context); 466Assert.Throws<InvalidOperationException>(() => iManager.Context); 471Assert.Throws<InvalidOperationException>(() => iManager.Context); 707Assert.Throws<InvalidOperationException>(manager.CreateSession); 868Assert.Throws<InvalidOperationException>(() => iManager.GetInstance(name)); 966Assert.Throws<InvalidOperationException>(() => iManager.GetName("value")); 1284Assert.Throws<MissingMethodException>(() => manager.GetSerializer(null, typeof(ClassWithInterfaceDefaultSerializationProvider))); 1404Assert.Throws<MissingMethodException>(() => iManager.GetSerializer(null, typeof(ClassWithInterfaceDefaultSerializationProvider))); 1631Assert.Throws<InvalidOperationException>(() => iManager.GetType(typeName));
System\Drawing\Design\ImageEditorTests.cs (1)
146Assert.Throws<ArgumentException>(() => editor.LoadFromStream(stream));
System\Drawing\Design\MetafileEditorTests.cs (1)
60Assert.Throws<ExternalException>(() => editor.LoadFromStream(stream));
System\Drawing\Design\ToolboxItemTests.cs (8)
591Assert.Throws<InvalidOperationException>(() => item.CreateComponents(mockDesignerHost.Object)); 595Assert.Throws<InvalidOperationException>(() => item.CreateComponents(mockDesignerHost.Object, null)); 599Assert.Throws<InvalidOperationException>(() => item.CreateComponents(mockDesignerHost.Object, new Hashtable())); 607Assert.Throws<InvalidOperationException>(() => item.CreateComponents(mockDesignerHost.Object)); 914Assert.Throws<InvalidOperationException>(() => item.CreateComponentsCore(mockDesignerHost.Object, null)); 918Assert.Throws<InvalidOperationException>(() => item.CreateComponentsCore(mockDesignerHost.Object, new Hashtable())); 1321Assert.Throws<ArgumentException>(() => item.GetType(mockDesignerHost.Object, new AssemblyName(), "typeName", false)); 1322Assert.Throws<ArgumentException>(() => item.GetType(null, new AssemblyName(), "typeName", false));
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (1)
180Assert.Throws<ArgumentException>(() => StronglyTypedResourceBuilder.Create(
System\Windows\Forms\Design\DataMemberFieldConverterTests.cs (1)
45Assert.Throws<NotSupportedException>(
System\Windows\Forms\Design\EventHandlerServiceTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => service.GetHandler(null));
System.Windows.Forms.Primitives.Tests (3)
Interop\Oleaut32\VARIANTTests.cs (3)
5662Assert.Throws<ArgumentException>(() => Marshal.GetObjectForNativeVariant(pv)); 5759Assert.Throws<T>(() => Marshal.GetObjectForNativeVariant(pv)); 5772Assert.Throws<T>(() => Marshal.GetObjectForNativeVariant(pv));
System.Windows.Forms.Primitives.TestUtilities (2)
Extensions\AssertExtensions.cs (2)
61T exception = Assert.Throws<T>(testCode); 131T exception = Assert.Throws<T>(testCode);
System.Windows.Forms.Tests (623)
BindingNavigatorTests.cs (1)
43ArgumentNullException ex = Assert.Throws<ArgumentNullException>(() => new BindingNavigator(nullContainer));
CheckedListBoxTests.cs (2)
111ArgumentException ex = Assert.Throws<ArgumentException>(() => box.SelectionMode = expected); 259ArgumentOutOfRangeException ex = Assert.Throws<ArgumentOutOfRangeException>(() => box.GetItemCheckState(index));
ContextMenuStripTests.cs (1)
27ArgumentNullException ex = Assert.Throws<ArgumentNullException>(() => new ContextMenuStrip(nullContainer));
SerializableTypesTests.cs (3)
312Assert.Throws<NullReferenceException>(() => result.ColumnCount); 313Assert.Throws<NullReferenceException>(() => result.GrowStyle); 314Assert.Throws<NullReferenceException>(() => result.RowCount);
System\Resources\ResXResourceReaderTests.cs (1)
50Assert.Throws<ArgumentException>(resxReader.GetEnumerator);
System\Windows\Forms\AccessibleObjects\ButtonBase.ButtonBaseAccessibleObjectTests.cs (2)
14Assert.Throws<ArgumentException>(() => new ButtonBase.ButtonBaseAccessibleObject(null)); 21Assert.Throws<ArgumentException>(() => new ButtonBase.ButtonBaseAccessibleObject(textBox));
System\Windows\Forms\AccessibleObjects\CheckBox.CheckBoxAccessibleObjectTests.cs (2)
15Assert.Throws<ArgumentException>(() => new CheckBoxAccessibleObject(null)); 22Assert.Throws<ArgumentException>(() => new CheckBoxAccessibleObject(textBox));
System\Windows\Forms\AccessibleObjects\ComboBox.ChildAccessibleObjectTests.cs (1)
11Assert.Throws<ArgumentNullException>(() => new ComboBox.ChildAccessibleObject(null, IntPtr.Zero));
System\Windows\Forms\AccessibleObjects\Control.ControlAccessibleObjectTests.cs (5)
1049Assert.Throws<InvalidOperationException>(() => accessibleObject.RaiseLiveRegionChanged()); 1436Assert.Throws<ArgumentException>(() => toolStrip.Items.Add(host)); 1503Assert.Throws<ArgumentException>(() => toolStrip.Items.Add(host)); 1540Assert.Throws<ArgumentException>(() => toolStrip.Items.Add(host)); 1577Assert.Throws<ArgumentException>(() => toolStrip.Items.Add(host));
System\Windows\Forms\AccessibleObjects\DataGridViewCellAccessibleObjectTests.cs (10)
129Assert.Throws<InvalidOperationException>(() => accessibleObject.Bounds); 168Assert.Throws<InvalidOperationException>(() => accessibleObject.DefaultAction); 285Assert.Throws<InvalidOperationException>(() => accessibleObject.Name); 306Assert.Throws<InvalidOperationException>(() => accessibleObject.Owner = owner); 330Assert.Throws<InvalidOperationException>(() => accessibleObject.Parent); 337Assert.Throws<InvalidOperationException>(() => accessibleObject.State); 365Assert.Throws<InvalidOperationException>(() => accessibleObject.Value); 379Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChild(-1)); 395Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChildCount()); 444Assert.Throws<InvalidOperationException>(() => accessibleObject.Navigate(AccessibleNavigation.Right));
System\Windows\Forms\AccessibleObjects\DataGridViewCheckBoxCellAccessibleObjectTests.cs (1)
105Assert.Throws<InvalidOperationException>(()
System\Windows\Forms\AccessibleObjects\DataGridViewColumnHeaderCellAccessibleObjectTests.cs (1)
21Assert.Throws<InvalidOperationException>(() => new DataGridViewColumnHeaderCellAccessibleObject(null).Parent);
System\Windows\Forms\AccessibleObjects\DataGridViewRowAccessibleObjectTests.cs (11)
63Assert.Throws<InvalidOperationException>(() => accessibleObject.Bounds); 161Assert.Throws<InvalidOperationException>(() => accessibleObject.Name); 180Assert.Throws<InvalidOperationException>(() => accessibleObject.Owner = owner); 199Assert.Throws<InvalidOperationException>(() => accessibleObject.Parent); 218Assert.Throws<InvalidOperationException>(() => accessibleObject.State); 237Assert.Throws<InvalidOperationException>(() => accessibleObject.Value); 251Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChild(0)); 278Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChildCount()); 294Assert.Throws<InvalidOperationException>(accessibleObject.GetFocused); 325Assert.Throws<InvalidOperationException>(accessibleObject.GetSelected); 347Assert.Throws<InvalidOperationException>(() => accessibleObject.Navigate(AccessibleNavigation.Right));
System\Windows\Forms\AccessibleObjects\DataGridViewRowHeaderCellAccessibleObjectTests.cs (1)
21Assert.Throws<InvalidOperationException>(() => new DataGridViewRowHeaderCellAccessibleObject(null).Parent);
System\Windows\Forms\AccessibleObjects\DataGridViewTopLeftHeaderCellAccessibleObjectTests.cs (1)
22Assert.Throws<InvalidOperationException>(() =>
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemAccessibleObjectTests.cs (2)
1760Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChild(0)); 1793Assert.Throws<InvalidOperationException>(() => accessibleObject.GetChildCount());
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemBaseAccessibleObjectTests.cs (1)
16Assert.Throws<ArgumentNullException>(() => new SubListViewItemBaseAccessibleObject(null));
System\Windows\Forms\AccessibleObjects\MonthCalendar.MonthCalendarChildAccessibleObjectTests.cs (1)
15Assert.Throws<ArgumentNullException>(() => new SubObject(null));
System\Windows\Forms\AccessibleObjects\RadioButton.RadioButtonAccessibleObjectTests.cs (1)
15Assert.Throws<ArgumentNullException>(() => new RadioButtonAccessibleObject(null));
System\Windows\Forms\AccessibleObjects\ToolStripDropDownItemAccessibleObjectTests.cs (1)
13Assert.Throws<ArgumentNullException>(() => new ToolStripDropDownItemAccessibleObject(null));
System\Windows\Forms\AccessibleObjects\ToolStripTextBox.ToolStripTextBoxControlAccessibleObjectTests.cs (1)
30Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(type, (Control)null));
System\Windows\Forms\AccessibleObjects\TrackBar.TrackBarAccessibleObjectTests.cs (1)
116Assert.Throws<COMException>(() => accessibilityObject.Value = value);
System\Windows\Forms\AccessibleObjects\TrackBar.TrackBarChildAccessibleObjectTests.cs (1)
15Assert.Throws<ArgumentNullException>(() => new SubTrackBarChildAccessibleObject(null));
System\Windows\Forms\AutoCompleteStringCollectionTests.cs (12)
279Assert.Throws<InvalidOperationException>(() => enumerator.Current); 282Assert.Throws<InvalidOperationException>(() => enumerator.Current); 286Assert.Throws<InvalidOperationException>(() => enumerator.Current); 301Assert.Throws<InvalidOperationException>(() => enumerator.Current); 307Assert.Throws<InvalidOperationException>(() => enumerator.Current); 311Assert.Throws<InvalidOperationException>(() => enumerator.Current); 326Assert.Throws<InvalidOperationException>(() => enumerator.Current); 329Assert.Throws<InvalidOperationException>(() => enumerator.Current); 333Assert.Throws<InvalidOperationException>(() => enumerator.Current); 349Assert.Throws<InvalidOperationException>(() => enumerator.Current); 355Assert.Throws<InvalidOperationException>(() => enumerator.Current); 359Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\AxHost.AxPropertyDescriptorTests.cs (1)
732Assert.Throws<TargetInvocationException>(() => property.GetValue(new object()));
System\Windows\Forms\AxHost.ConnectionPointCookieTests.cs (5)
37Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, null, null)); 38Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, new object(), typeof(int))); 46Assert.Throws<NullReferenceException>(() => new AxHost.ConnectionPointCookie(source, null, null)); 58Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, null, eventInterface)); 74Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, sink, eventInterface));
System\Windows\Forms\AxHostTests.cs (5)
225Assert.Throws<FormatException>(() => new SubAxHost(clsid)); 1440Assert.Throws<InvalidCastException>(() => SubAxHost.GetFontFromIFont(new object())); 1655Assert.Throws<COMException>(() => SubAxHost.GetIPictureDispFromPicture(original)); 1723Assert.Throws<COMException>(() => SubAxHost.GetIPictureFromPicture(original)); 1735Assert.Throws<InvalidCastException>(() => SubAxHost.GetPictureFromIPicture(new object()));
System\Windows\Forms\BaseCollectionTests.cs (1)
14Assert.Throws<NullReferenceException>(() => collection.Count);
System\Windows\Forms\BindingContextTests.cs (2)
538Assert.Throws<ArgumentException>(() => context[dataSource, "Property"]); 566Assert.Throws<ArgumentException>(() => context[dataSource, dataMember]);
System\Windows\Forms\BindingSourceTests.cs (7)
25Assert.Throws<IndexOutOfRangeException>(() => source.CurrencyManager.Current); 84Assert.Throws<IndexOutOfRangeException>(() => source.CurrencyManager.Current); 149Assert.Throws<IndexOutOfRangeException>(() => source.CurrencyManager.Current); 414Assert.Throws<IndexOutOfRangeException>(() => source.CurrencyManager.Current); 465Assert.Throws<NotSupportedException>(() => new BindingSource(dataSource, "dataMember")); 471Assert.Throws<ArgumentException>(() => new BindingSource(new DataClass(), "NoSuchProperty")); 488Assert.Throws<IndexOutOfRangeException>(() => source.CurrencyManager.Current);
System\Windows\Forms\ButtonBaseTests.cs (6)
96Assert.Throws<NullReferenceException>(() => control.PreferredSize); 3027Assert.Throws<ArgumentException>(() => control.Parent = control); 5018Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5022Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5045Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize)); 5052Assert.Throws<NullReferenceException>(() => control.GetPreferredSize(proposedSize));
System\Windows\Forms\ColumnHeaderCollectionTests.cs (1)
98Assert.Throws<NotSupportedException>(() => collection[index] = new ColumnHeader());
System\Windows\Forms\ColumnHeaderConverterTests.cs (4)
31Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 107Assert.Throws<ArgumentException>(() => converter.ConvertTo(value, typeof(InstanceDescriptor))); 130Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 139Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ColumnHeader(), destinationType));
System\Windows\Forms\ColumnHeaderTests.cs (2)
498Assert.Throws<InvalidOperationException>(() => header.ImageIndex = 0); 712Assert.Throws<InvalidOperationException>(() => header.ImageKey = "Key");
System\Windows\Forms\Combobox.ObjectCollectionTests.cs (8)
116Assert.Throws<ArgumentException>(() => comboBoxObjectCollection.Add("a")); 1373Assert.Throws<ArgumentException>(() => comboBoxObjectCollection[0] = 1); 1394Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1397Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1401Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1429Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1435Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1439Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\CommonDialogTests.cs (1)
224Assert.Throws<Win32Exception>(() => dialog.ShowDialog(owner.Object));
System\Windows\Forms\ControlPaintTests.cs (2)
82Assert.Throws<ArgumentNullException>(() => ControlPaint.CreateHBitmap16Bit(null, Color.Red)); 193Assert.Throws<ArgumentNullException>(() => ControlPaint.CreateHBitmapColorMask(null, IntPtr.Zero));
System\Windows\Forms\ControlTests.ControlCollection.cs (2)
1581Assert.Throws<ArgumentException>(() => collection.GetChildIndex(child)); 1582Assert.Throws<ArgumentException>(() => collection.GetChildIndex(child));
System\Windows\Forms\ControlTests.Methods.cs (7)
3907DivideByZeroException exception = Assert.Throws<DivideByZeroException>(() => control.Invoke((MethodInvoker)FaultingMethod)); 4026var exception = Assert.Throws<DivideByZeroException>(() => control.Invoke((MethodInvoker)FaultingMethod)); 4093var exception = Assert.Throws<DivideByZeroException>(() => control.Invoke((MethodInvoker)FaultingMethod)); 4133Assert.Throws<InvalidOperationException>(() => control.Invoke(method, Array.Empty<object>())); 4142Assert.Throws<TargetParameterCountException>(() => control.Invoke(method)); 4143Assert.Throws<TargetParameterCountException>(() => control.Invoke(method, null)); 4144Assert.Throws<TargetParameterCountException>(() => control.Invoke(method, Array.Empty<object>()));
System\Windows\Forms\ControlTests.Properties.cs (5)
291Assert.Throws<InvalidOperationException>(() => control.AllowDrop = true); 1598Assert.Throws<ArgumentException>(() => control.BackColor = Color.FromArgb(254, 1, 2, 3)); 9808Assert.Throws<ArgumentException>(() => control.Parent = control); 9819Assert.Throws<ArgumentException>(() => control.Parent = child); 9830Assert.Throws<ArgumentException>(() => control.Parent = parent);
System\Windows\Forms\CursorConverterTests.cs (6)
52Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 106Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new Cursor(Cursors.AppStarting.Handle), typeof(InstanceDescriptor))); 120Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, typeof(InstanceDescriptor))); 147Assert.Throws<FormatException>(() => converter.ConvertTo(Cursors.AppStarting, typeof(byte[]))); 148Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(new Cursor(Cursors.AppStarting.Handle), typeof(byte[]))); 178Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, destinationType));
System\Windows\Forms\CursorTests.cs (5)
142Assert.Throws<FileNotFoundException>(() => new Cursor("NoSuchFile")); 344Assert.Throws<ObjectDisposedException>(() => cursor.Handle); 345Assert.Throws<ObjectDisposedException>(() => cursor.HotSpot); 348Assert.Throws<ObjectDisposedException>(() => cursor.Handle); 349Assert.Throws<ObjectDisposedException>(() => cursor.HotSpot);
System\Windows\Forms\DataFormatsTests.cs (1)
121Assert.Throws<Win32Exception>(() => DataFormats.GetFormat(format));
System\Windows\Forms\DataGridViewCellTests.cs (28)
696Assert.Throws<InvalidOperationException>(() => cell.ErrorIconBounds); 705Assert.Throws<InvalidOperationException>(() => cell.ErrorIconBounds); 714Assert.Throws<InvalidOperationException>(() => cell.ErrorIconBounds); 1510Assert.Throws<InvalidOperationException>(() => cell.InheritedStyle); 1519Assert.Throws<InvalidOperationException>(() => cell.InheritedStyle); 1528Assert.Throws<InvalidOperationException>(() => cell.InheritedStyle); 1574Assert.Throws<InvalidOperationException>(() => cell.IsInEditMode); 1660Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = true); 1768Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = true); 1771Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = false); 1967Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 2112Assert.Throws<InvalidOperationException>(() => cell.Selected = true); 2126Assert.Throws<InvalidOperationException>(() => cell.Selected = true); 2141Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 2189Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 4636Assert.Throws<ArgumentException>(() => cell.GetInheritedState(rowIndex)); 4647Assert.Throws<ArgumentException>(() => cell.GetInheritedState(rowIndex)); 4699Assert.Throws<InvalidOperationException>(() => cell.GetInheritedStyle(new DataGridViewCellStyle(), -1, true)); 4706Assert.Throws<InvalidOperationException>(() => cell.GetInheritedStyle(new DataGridViewCellStyle(), -1, true)); 4715Assert.Throws<InvalidOperationException>(() => cell.GetInheritedStyle(new DataGridViewCellStyle(), -1, true)); 4724Assert.Throws<InvalidOperationException>(() => cell.GetInheritedStyle(new DataGridViewCellStyle(), -1, true)); 4919Assert.Throws<InvalidOperationException>(() => cell.GetSize(-1)); 4933Assert.Throws<InvalidOperationException>(() => cell.GetSize(-1)); 6169Assert.Throws<FormatException>(() => cell.ParseFormattedValue(1, new DataGridViewCellStyle(), new Int32Converter(), new Int32Converter())); 6176Assert.Throws<FormatException>(() => cell.ParseFormattedValue(1, new DataGridViewCellStyle(), new Int32Converter(), new Int32Converter())); 6183Assert.Throws<FormatException>(() => cell.ParseFormattedValue(1, new DataGridViewCellStyle(), new Int32Converter(), new Int32Converter())); 6202Assert.Throws<FormatException>(() => cell.ParseFormattedValue(formattedValue, cellStyle, formattedValueTypeConverter, valueTypeConverter)); 6236Assert.Throws<InvalidOperationException>(() => cell.PositionEditingPanel(new Rectangle(1, 2, 3, 4), new Rectangle(1, 2, 3, 4), new DataGridViewCellStyle(), true, true, true, true));
System\Windows\Forms\DataGridViewColumnCollectionTests.cs (14)
342Assert.Throws<InvalidOperationException>(() => collection.Add(null)); 343Assert.Throws<InvalidOperationException>(() => collection.Add(column)); 364Assert.Throws<InvalidOperationException>(() => collection.Add(null)); 365Assert.Throws<InvalidOperationException>(() => collection.Add(column)); 383Assert.Throws<InvalidOperationException>(() => collection.Add(column1)); 384Assert.Throws<InvalidOperationException>(() => collection.Add(column2)); 401Assert.Throws<InvalidOperationException>(() => collection.Add(column)); 442Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column)); 460Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column)); 473Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column2)); 486Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column2)); 532Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column3)); 540Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column)); 551Assert.Throws<InvalidOperationException>(() => control.Columns.Add(column));
System\Windows\Forms\DataGridViewColumnStateChangedEventArgsTests.cs (1)
21Assert.Throws<ArgumentNullException>(() => new DataGridViewColumnStateChangedEventArgs(null, DataGridViewElementStates.Displayed));
System\Windows\Forms\DataGridViewColumnTests.cs (6)
268Assert.Throws<InvalidOperationException>(() => column.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader); 307Assert.Throws<InvalidOperationException>(() => column.AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet); 323Assert.Throws<InvalidOperationException>(() => column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill); 360Assert.Throws<InvalidOperationException>(() => column.AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet); 1772Assert.Throws<ArgumentException>(() => column.GetPreferredWidth(autoSizeColumnMode, fixedHeight: true)); 1773Assert.Throws<ArgumentException>(() => column.GetPreferredWidth(autoSizeColumnMode, fixedHeight: false));
System\Windows\Forms\DataGridViewDataErrorEventArgsTests.cs (1)
61Assert.Throws<ArgumentException>(() => e.ThrowException = true);
System\Windows\Forms\DataGridViewEditingControlShowingEventArgsTests.cs (1)
19Assert.Throws<ArgumentNullException>(() => new DataGridViewEditingControlShowingEventArgs(control, cellStyle));
System\Windows\Forms\DataGridViewHeaderCellTests.cs (23)
254Assert.Throws<InvalidOperationException>(() => cell.Displayed); 433Assert.Throws<InvalidOperationException>(() => cell.Displayed); 540Assert.Throws<InvalidOperationException>(() => cell.Frozen); 721Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 733Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 744Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 755Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 771Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 791Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 810Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 824Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 841Assert.Throws<InvalidOperationException>(() => cell.ReadOnly = value); 1059Assert.Throws<InvalidOperationException>(() => cell.Resizable); 1206Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1218Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1230Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1242Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1259Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1279Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1298Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1313Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 1331Assert.Throws<InvalidOperationException>(() => cell.Selected = value); 2011Assert.Throws<InvalidOperationException>(() => cell.Visible);
System\Windows\Forms\DataGridViewRowTests.cs (30)
36Assert.Throws<InvalidOperationException>(() => row.InheritedStyle); 143Assert.Throws<InvalidOperationException>(() => row.ContextMenuStrip); 218Assert.Throws<InvalidOperationException>(() => row.ContextMenuStrip); 223Assert.Throws<InvalidOperationException>(() => row.ContextMenuStrip); 568Assert.Throws<InvalidOperationException>(() => row.DefaultCellStyle = new DataGridViewCellStyle()); 757Assert.Throws<InvalidOperationException>(() => row.Displayed); 886Assert.Throws<InvalidOperationException>(() => row.DividerHeight = -1); 976Assert.Throws<InvalidOperationException>(() => row.ErrorText); 1151Assert.Throws<InvalidOperationException>(() => control.Rows.SharedRow(0).Frozen); 1368Assert.Throws<InvalidOperationException>(() => control.Rows.SharedRow(0).Frozen = value); 2051Assert.Throws<InvalidOperationException>(() => row.Height = -1); 2185Assert.Throws<InvalidOperationException>(() => row.InheritedStyle); 2197Assert.Throws<InvalidOperationException>(() => row.InheritedStyle); 2499Assert.Throws<InvalidOperationException>(() => row.MinimumHeight = -1); 2541Assert.Throws<InvalidOperationException>(() => row.ReadOnly); 2723Assert.Throws<InvalidOperationException>(() => row.ReadOnly = true); 2752Assert.Throws<InvalidOperationException>(() => row.Resizable); 2764Assert.Throws<InvalidOperationException>(() => row.Resizable); 2924Assert.Throws<InvalidOperationException>(() => row.Selected); 2931Assert.Throws<InvalidOperationException>(() => row.Selected = true); 3049Assert.Throws<InvalidOperationException>(() => row.Selected = value); 3073Assert.Throws<InvalidOperationException>(() => row.State); 3239Assert.Throws<InvalidOperationException>(() => row.Visible); 3354Assert.Throws<InvalidOperationException>(() => row.Visible = false); 3370Assert.Throws<InvalidOperationException>(() => row.Visible = true); 3371Assert.Throws<InvalidOperationException>(() => row.Visible = false); 4381Assert.Throws<InvalidOperationException>(() => row.GetContextMenuStrip(-1)); 4505Assert.Throws<InvalidOperationException>(() => row.GetErrorText(-1)); 5738Assert.Throws<InvalidOperationException>(() => row.SetValues(Array.Empty<object>())); 5750Assert.Throws<InvalidOperationException>(() => row.SetValues(Array.Empty<object>()));
System\Windows\Forms\DataGridViewSelectedCellCollectionTests.cs (8)
280Assert.Throws<NotSupportedException>(() => iList[index] = value); 297Assert.Throws<NotSupportedException>(() => iList.Add(value)); 388Assert.Throws<InvalidOperationException>(() => enumerator.Current); 391Assert.Throws<InvalidOperationException>(() => enumerator.Current); 394Assert.Throws<InvalidOperationException>(() => enumerator.Current); 416Assert.Throws<InvalidOperationException>(() => enumerator.Current); 425Assert.Throws<InvalidOperationException>(() => enumerator.Current); 428Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\DataGridViewSelectedColumnCollectionTests.cs (8)
312Assert.Throws<NotSupportedException>(() => iList[index] = value); 329Assert.Throws<NotSupportedException>(() => iList.Add(value)); 428Assert.Throws<InvalidOperationException>(() => enumerator.Current); 431Assert.Throws<InvalidOperationException>(() => enumerator.Current); 434Assert.Throws<InvalidOperationException>(() => enumerator.Current); 460Assert.Throws<InvalidOperationException>(() => enumerator.Current); 469Assert.Throws<InvalidOperationException>(() => enumerator.Current); 472Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\DataGridViewSelectedRowCollectionTests.cs (8)
272Assert.Throws<NotSupportedException>(() => iList[index] = value); 289Assert.Throws<NotSupportedException>(() => iList.Add(value)); 378Assert.Throws<InvalidOperationException>(() => enumerator.Current); 381Assert.Throws<InvalidOperationException>(() => enumerator.Current); 384Assert.Throws<InvalidOperationException>(() => enumerator.Current); 405Assert.Throws<InvalidOperationException>(() => enumerator.Current); 414Assert.Throws<InvalidOperationException>(() => enumerator.Current); 417Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\DataGridViewTests.cs (1)
946Assert.Throws<ArgumentException>(() => control.Parent = control);
System\Windows\Forms\DataGridViewTextBoxEditingControlTests.cs (3)
263Assert.Throws<InvalidOperationException>(() => control.EditingControlFormattedValue = "text"); 285Assert.Throws<InvalidCastException>(() => control.EditingControlFormattedValue = new object()); 395Assert.Throws<InvalidOperationException>(() => control.Text = "text");
System\Windows\Forms\Design\PropertyTabTests.cs (4)
56Assert.Throws<ArgumentException>(() => bitmap.Size); 61Assert.Throws<ArgumentException>(() => bitmap.Size); 100Assert.Throws<ArgumentException>(() => bitmap.Size); 112Assert.Throws<ArgumentException>(() => bitmap.Size);
System\Windows\Forms\ErrorProviderTests.cs (1)
361Assert.Throws<ArgumentException>(() => provider.DataMember = "NoSuchValue");
System\Windows\Forms\FeatureSupportTests.cs (3)
93Assert.Throws<TargetException>(() => FeatureSupport.GetVersionPresent(featureClassType.AssemblyQualifiedName, featureConstName)); 156Assert.Throws<TargetException>(() => FeatureSupport.IsPresent(featureClassType.AssemblyQualifiedName, featureConstName)); 157Assert.Throws<TargetException>(() => FeatureSupport.IsPresent(featureClassType.AssemblyQualifiedName, featureConstName, new Version(1, 2, 3, 4)));
System\Windows\Forms\FlowLayoutSettingsTests.cs (1)
122Assert.Throws<NotSupportedException>(() => settings.GetFlowBreak(new object()));
System\Windows\Forms\FormTests.cs (2)
1196Assert.Throws<ArgumentException>(() => control.Parent = control); 1205Assert.Throws<ArgumentException>(() => control.Parent = parent);
System\Windows\Forms\GridItemTests.cs (1)
30Assert.Throws<NotSupportedException>(() => item.Expanded = value);
System\Windows\Forms\HtmlDocumentTests.cs (6)
546Assert.Throws<COMException>(() => document.Domain = value); 670Assert.Throws<ArgumentException>(() => document.Encoding = value); 1565Assert.Throws<ArgumentException>(() => document.CreateElement(null)); 1647Assert.Throws<InvalidCastException>(() => document.Equals(new object())); 1736Assert.Throws<ArgumentException>(() => document.GetElementById(null)); 1812Assert.Throws<ArgumentException>(() => document.GetElementsByTagName(null));
System\Windows\Forms\HtmlElementTests.cs (11)
495Assert.Throws<NotSupportedException>(() => element.InnerHtml = "InnerText"); 510Assert.Throws<NotSupportedException>(() => element.InnerHtml = "InnerHtml"); 616Assert.Throws<NotSupportedException>(() => element.InnerText = "InnerText"); 631Assert.Throws<NotSupportedException>(() => element.InnerText = "InnerText"); 922Assert.Throws<NotSupportedException>(() => element.OuterHtml = "OuterHtml"); 1028Assert.Throws<NotSupportedException>(() => element.OuterText = "OuterText"); 1501Assert.Throws<NullReferenceException>(() => element.AppendChild(null)); 1917Assert.Throws<ArgumentException>(() => element.GetAttribute(null)); 1957Assert.Throws<ArgumentException>(() => element.GetElementsByTagName(null)); 2318Assert.Throws<NullReferenceException>(() => element.InsertAdjacentElement(HtmlElementInsertionOrientation.BeforeEnd, null)); 2335Assert.Throws<ArgumentException>(() => element.InsertAdjacentElement(orient, newElement));
System\Windows\Forms\ImageList.ImageCollectionTests.cs (15)
340Assert.Throws<ArgumentException>(() => collection[0] = value); 808Assert.Throws<ArgumentException>(() => collection.Add(value, Color.Transparent)); 1067Assert.Throws<NotSupportedException>(() => collection.Contains(image)); 1122Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1125Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1142Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1145Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1167Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1182Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1205Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1220Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1281Assert.Throws<NotSupportedException>(() => collection.IndexOf(image)); 1724Assert.Throws<ArgumentException>(() => collection[0] = value); 1739Assert.Throws<NotSupportedException>(() => collection.Contains(value)); 1770Assert.Throws<NotSupportedException>(() => collection.IndexOf(value));
System\Windows\Forms\ImageListTests.cs (1)
838Assert.Throws<ObjectDisposedException>(list.Images.GetEnumerator);
System\Windows\Forms\ItemCheckedEventArgsTests.cs (1)
12Assert.Throws<ArgumentNullException>(() => new ItemCheckedEventArgs(null));
System\Windows\Forms\LabelTests.cs (2)
636Assert.Throws<ArgumentOutOfRangeException>(() => label.ImageIndex = -2); 735Assert.Throws<InvalidEnumArgumentException>(() => label.LiveSetting = (AutomationLiveSetting)999);
System\Windows\Forms\Layout\FlowLayoutTests.cs (1)
281Assert.Throws<NotSupportedException>(() => engine.Layout("container", new LayoutEventArgs(control, "affectedProperty")));
System\Windows\Forms\Layout\LayoutEngineTests.cs (1)
42Assert.Throws<NotSupportedException>(() => engine.Layout("container", new LayoutEventArgs(new Component(), "affectedProperty")));
System\Windows\Forms\Layout\TableLayoutSettingsTests.cs (13)
35Assert.Throws<NullReferenceException>(() => settings.GrowStyle); 36Assert.Throws<NullReferenceException>(() => settings.ColumnCount); 41Assert.Throws<NullReferenceException>(() => settings.RowCount); 195Assert.Throws<NotSupportedException>(() => settings.GetCellPosition("control")); 285Assert.Throws<NotSupportedException>(() => settings.GetColumn("control")); 336Assert.Throws<NotSupportedException>(() => settings.GetColumnSpan("control")); 386Assert.Throws<NotSupportedException>(() => settings.GetRow("control")); 436Assert.Throws<NotSupportedException>(() => settings.GetRowSpan("control")); 1765Assert.Throws<SerializationException>(() => info.GetString("SerializedString")); 1823Assert.Throws<SerializationException>(() => formatter.Deserialize(stream)); // CodeQL [SM03722] : Testing legacy feature. This is a safe use of BinaryFormatter because the data is trusted and the types are controlled and validated. 1850Assert.Throws<NullReferenceException>(() => result.ColumnCount); 1851Assert.Throws<NullReferenceException>(() => result.RowCount); 1854Assert.Throws<NullReferenceException>(() => result.GrowStyle);
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (9)
115Assert.Throws<XmlException>(() => converter.ConvertFrom(value)); 125Assert.Throws<ArgumentException>(() => converter.ConvertFrom($@"<?xml version=""1.0"" encoding=""utf-16""?><Root><Columns Styles=""{style}"" /></Root>")); 135Assert.Throws<IndexOutOfRangeException>(() => converter.ConvertFrom($@"<?xml version=""1.0"" encoding=""utf-16""?><Root><Columns Styles=""{style}"" /></Root>")); 144Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 242Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(settings, typeof(string))); 260Assert.Throws<InvalidCastException>(() => settings.ColumnStyles.Add(new RowStyle())); 263Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string))); 274Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string))); 299Assert.Throws<NotSupportedException>(() => converter.ConvertTo(toolStrip.LayoutSettings, destinationType));
System\Windows\Forms\LinkAreaConverterTests.cs (4)
48Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 57Assert.Throws<ArgumentException>(() => converter.ConvertFrom(value)); 101Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 110Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(LinkArea), destinationType));
System\Windows\Forms\LinkConverterTests.cs (4)
46Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 55Assert.Throws<ArgumentException>(() => converter.ConvertFrom(value)); 110Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 119Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new LinkLabel.Link(), destinationType));
System\Windows\Forms\ListBindingHelperTests.cs (9)
86Assert.Throws<ArgumentException>(() => ListBindingHelper.GetList(dataSource, dataMember)); 227Assert.Throws<NotSupportedException>(() => ListBindingHelper.GetListItemType(list)); 228Assert.Throws<NotSupportedException>(() => ListBindingHelper.GetListItemType(list, null)); 229Assert.Throws<NotSupportedException>(() => ListBindingHelper.GetListItemType(list, string.Empty)); 230Assert.Throws<NotSupportedException>(() => ListBindingHelper.GetListItemType(list, "dataMember")); 450Assert.Throws<ArgumentException>(() => ListBindingHelper.GetListItemProperties(list, dataMember, null)); 456Assert.Throws<TargetInvocationException>(() => ListBindingHelper.GetListItemProperties(new DataClass(), TypeDescriptor.GetProperties(typeof(ListDataClass)).Cast<PropertyDescriptor>().ToArray())); 457Assert.Throws<TargetInvocationException>(() => ListBindingHelper.GetListItemProperties(new DataClass(), null, TypeDescriptor.GetProperties(typeof(ListDataClass)).Cast<PropertyDescriptor>().ToArray())); 458Assert.Throws<TargetInvocationException>(() => ListBindingHelper.GetListItemProperties(new DataClass(), string.Empty, TypeDescriptor.GetProperties(typeof(ListDataClass)).Cast<PropertyDescriptor>().ToArray()));
System\Windows\Forms\ListBox.IntegerCollectionTests.cs (8)
1740Assert.Throws<ArgumentException>(() => collection[index] = item); 1960Assert.Throws<ArgumentException>(() => collection.Add(item)); 2242Assert.Throws<InvalidOperationException>(() => enumerator.Current); 2245Assert.Throws<InvalidOperationException>(() => enumerator.Current); 2249Assert.Throws<InvalidOperationException>(() => enumerator.Current); 2268Assert.Throws<InvalidOperationException>(() => enumerator.Current); 2274Assert.Throws<InvalidOperationException>(() => enumerator.Current); 2278Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\ListBox.ObjectCollectionTests.cs (18)
70Assert.Throws<ArgumentException>(() => new ListBox.ObjectCollection(owner, Array.Empty<object>())); 71Assert.Throws<ArgumentException>(() => new ListBox.ObjectCollection(owner, otherCollection)); 2195Assert.Throws<ArgumentException>(() => collection.Add(1)); 2212Assert.Throws<OutOfMemoryException>(() => collection.Add(1)); 4033Assert.Throws<InvalidOperationException>(() => enumerator.Current); 4036Assert.Throws<InvalidOperationException>(() => enumerator.Current); 4040Assert.Throws<InvalidOperationException>(() => enumerator.Current); 4059Assert.Throws<InvalidOperationException>(() => enumerator.Current); 4065Assert.Throws<InvalidOperationException>(() => enumerator.Current); 4069Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9000Assert.Throws<ArgumentException>(() => collection.Add(1)); 9017Assert.Throws<OutOfMemoryException>(() => collection.Add(1)); 9355Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9358Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9362Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9381Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9387Assert.Throws<InvalidOperationException>(() => enumerator.Current); 9391Assert.Throws<InvalidOperationException>(() => enumerator.Current);
System\Windows\Forms\ListBox.SelectedIndexCollectionTests.cs (2)
62Assert.Throws<NotSupportedException>(() => collection[index] = value); 73Assert.Throws<NotSupportedException>(() => collection.Add(value));
System\Windows\Forms\ListBox.SelectedObjectCollectionTests.cs (2)
62Assert.Throws<NotSupportedException>(() => collection[index] = value); 73Assert.Throws<NotSupportedException>(() => collection.Add(value));
System\Windows\Forms\ListBoxTests.cs (1)
5284Assert.Throws<Win32Exception>(() => control.GetItemHeight(0));
System\Windows\Forms\ListControlTests.cs (5)
2013Assert.Throws<IndexOutOfRangeException>(() => control.SelectedValue); 2085Assert.Throws<InvalidOperationException>(() => control.SelectedValue = value); 2087Assert.Throws<IndexOutOfRangeException>(() => control.SelectedValue); 2548Assert.Throws<StackOverflowException>(() => control.GetItemText(item)); 2551Assert.Throws<StackOverflowException>(() => control.GetItemText(item));
System\Windows\Forms\ListViewGroupCollectionTests.cs (4)
164Assert.Throws<ArgumentException>(() => collection[0] = group); 495Assert.Throws<ArgumentException>(() => collection.Add(group)); 1064Assert.Throws<InvalidOperationException>(() => listView.Groups.Add(new ListViewGroup())); 1080Assert.Throws<InvalidOperationException>(() => listView.Groups.Add(key: "key", headerText: "text"));
System\Windows\Forms\ListViewGroupConverterTests.cs (5)
113Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(mockContext.Object, null, "value")); 114Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(mockContext.Object, null, "HEADER")); 124Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 228Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 237Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewGroup(), destinationType));
System\Windows\Forms\ListViewGroupTests.cs (5)
1374Assert.Throws<SerializationException>(() => info.GetString("Name")); 1376Assert.Throws<SerializationException>(() => info.GetInt32("ItemsCount")); 1392Assert.Throws<SerializationException>(() => info.GetString("Name")); 1394Assert.Throws<SerializationException>(() => info.GetInt32("ItemsCount")); 1410Assert.Throws<SerializationException>(() => info.GetString("Name"));
System\Windows\Forms\ListViewItemConverterTests.cs (3)
33Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 283Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 292Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewItem(), destinationType));
System\Windows\Forms\ListViewSubItemCollectionTests.cs (2)
207Assert.Throws<InvalidOperationException>(() => collection.Add(new ListViewItem.ListViewSubItem())); 641Assert.Throws<InvalidOperationException>(() => collection.Add(new ListViewItem.ListViewSubItem()));
System\Windows\Forms\ListViewSubItemConverterTests.cs (3)
33Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 96Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 105Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewItem.ListViewSubItem(), destinationType));
System\Windows\Forms\ListViewTests.cs (2)
143Assert.Throws<InvalidOperationException>(() => control.TopItem); 1084Assert.Throws<NotSupportedException>(() => listView.CheckBoxes = true);
System\Windows\Forms\ListViewVirtualItemsSelectionRangeChangedEventArgsTests.cs (1)
26Assert.Throws<ArgumentException>(() => new ListViewVirtualItemsSelectionRangeChangedEventArgs(1, 0, false));
System\Windows\Forms\MonthCalendarTests.cs (1)
2490Assert.Throws<InvalidOperationException>(() => control.SingleMonthSize);
System\Windows\Forms\NotifyIconTests.cs (2)
310Assert.Throws<NullReferenceException>(() => notifyIcon.Icon = value); 565Assert.Throws<NullReferenceException>(() => notifyIcon.Visible = !value);
System\Windows\Forms\OpacityConverterTests.cs (4)
51Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 67Assert.Throws<FormatException>(() => converter.ConvertFrom(value)); 103Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 113Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1.1, destinationType));
System\Windows\Forms\PaddingConverterTests.cs (3)
50Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 113Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 122Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(Padding), destinationType));
System\Windows\Forms\PageSetupDialogTests.cs (1)
443Assert.Throws<ArgumentException>(() => dialog.ShowDialog());
System\Windows\Forms\PictureBoxTests.cs (1)
1213Assert.Throws<ArgumentException>(() => control.Parent = control);
System\Windows\Forms\PropertyGridInternal\AccessibleObjects\PropertyGridView.GridViewTextBox.GridViewTextBoxAccessibleObjectTests.cs (1)
114Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(accessibleObjectType, (TextBox)null));
System\Windows\Forms\PropertyGridTests.cs (4)
1026Assert.Throws<ArgumentException>(() => control.CommandsBackColor = Color.FromArgb(254, 1, 2, 3)); 1814Assert.Throws<ArgumentException>(() => control.HelpBackColor = Color.FromArgb(254, 1, 2, 3)); 2395Assert.Throws<InvalidCastException>(() => control.SelectedGridItem = mockGridItem.Object); 3284Assert.Throws<ArgumentException>(() => control.ViewBackColor = Color.FromArgb(254, 1, 2, 3));
System\Windows\Forms\RichTextBoxTests.cs (38)
2698Assert.Throws<ObjectDisposedException>(() => control.Rtf); 2871Assert.Throws<ArgumentException>(() => control.Rtf = "text"); 2900Assert.Throws<ObjectDisposedException>(() => control.Rtf = value); 3261Assert.Throws<ObjectDisposedException>(() => control.SelectedRtf); 3378Assert.Throws<ArgumentException>(() => control.SelectedRtf = "text"); 3407Assert.Throws<ObjectDisposedException>(() => control.SelectedRtf = value); 3507Assert.Throws<ObjectDisposedException>(() => control.SelectedText); 3630Assert.Throws<ObjectDisposedException>(() => control.SelectedText = value); 3714Assert.Throws<ObjectDisposedException>(() => control.SelectionAlignment); 3814Assert.Throws<ObjectDisposedException>(() => control.SelectionAlignment = value); 4103Assert.Throws<ObjectDisposedException>(() => control.SelectionBullet); 4269Assert.Throws<ObjectDisposedException>(() => control.SelectionBullet = value); 4364Assert.Throws<ObjectDisposedException>(() => control.SelectionCharOffset); 4470Assert.Throws<ObjectDisposedException>(() => control.SelectionCharOffset = value); 4554Assert.Throws<ObjectDisposedException>(() => control.SelectionColor); 4653Assert.Throws<ObjectDisposedException>(() => control.SelectionColor = value); 4809Assert.Throws<ObjectDisposedException>(() => control.SelectionFont); 4910Assert.Throws<ObjectDisposedException>(() => control.SelectionFont = value); 4947Assert.Throws<NullReferenceException>(() => control.SelectionFont = null); 5029Assert.Throws<ObjectDisposedException>(() => control.SelectionHangingIndent); 5185Assert.Throws<ObjectDisposedException>(() => control.SelectionHangingIndent = value); 5268Assert.Throws<ObjectDisposedException>(() => control.SelectionIndent); 5376Assert.Throws<ObjectDisposedException>(() => control.SelectionIndent = value); 5430Assert.Throws<ObjectDisposedException>(() => control.SelectionLength); 5586Assert.Throws<ObjectDisposedException>(() => control.SelectionLength = value); 5670Assert.Throws<ObjectDisposedException>(() => control.SelectionProtected); 5775Assert.Throws<ObjectDisposedException>(() => control.SelectionProtected = value); 5858Assert.Throws<ObjectDisposedException>(() => control.SelectionRightIndent); 5965Assert.Throws<ObjectDisposedException>(() => control.SelectionRightIndent = value); 6019Assert.Throws<ObjectDisposedException>(() => control.SelectionStart); 6169Assert.Throws<ObjectDisposedException>(() => control.SelectionStart = value); 6256Assert.Throws<ObjectDisposedException>(() => control.SelectionTabs); 6425Assert.Throws<ObjectDisposedException>(() => control.SelectionTabs = value); 6557Assert.Throws<ObjectDisposedException>(() => control.SelectionType); 7912Assert.Throws<NullReferenceException>(() => control.CanPaste(null)); 8544Assert.Throws<ArgumentException>(() => control.Find("s", 1, 0, RichTextBoxFinds.None)); 8545Assert.Throws<ArgumentException>(() => control.Find("s", 1, 0, RichTextBoxFinds.Reverse)); 9212Assert.Throws<ArgumentOutOfRangeException>(() => new LinkClickedEventArgs("text", linkStart, linkLength));
System\Windows\Forms\SplitterPanelTests.cs (4)
462Assert.Throws<NotSupportedException>(() => control.Height = value); 481Assert.Throws<NotSupportedException>(() => control.Height = value); 1184Assert.Throws<NotSupportedException>(() => control.Width = value); 1203Assert.Throws<NotSupportedException>(() => control.Width = value);
System\Windows\Forms\SplitterTests.cs (1)
729Assert.Throws<ArgumentException>(() => control.Dock = value);
System\Windows\Forms\StatusStripTests.cs (1)
614Assert.Throws<NotSupportedException>(() => control.RenderMode = ToolStripRenderMode.Custom);
System\Windows\Forms\TabControl.ControlCollectionTests.cs (3)
1368Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab); 1373Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab); 1378Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab);
System\Windows\Forms\TabControl.TabPageCollectionTests.cs (25)
1094Assert.Throws<ArgumentException>(() => iList.Add(value)); 1666Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1669Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1673Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1696Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1708Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1712Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1728Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1731Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1735Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1758Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1770Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1774Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1792Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1807Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1811Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1814Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1825Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1828Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1832Assert.Throws<InvalidOperationException>(() => enumerator.Current); 1843Assert.Throws<InvalidCastException>(collection.GetEnumerator); 3942Assert.Throws<ArgumentException>(() => iList[0] = value); 4472Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab); 4477Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab); 4482Assert.Throws<ArgumentOutOfRangeException>(() => owner.SelectedTab);
System\Windows\Forms\TabControlTests.cs (3)
3903Assert.Throws<InvalidCastException>(() => control.GetItems(baseType)); 3914Assert.Throws<InvalidCastException>(() => control.GetItems(typeof(int))); 3925Assert.Throws<ArrayTypeMismatchException>(() => control.GetItems(typeof(SubTabPage)));
System\Windows\Forms\TableLayoutColumnStyleCollectionTests.cs (3)
28Assert.Throws<InvalidCastException>(() => collection.Add(style)); 64Assert.Throws<InvalidCastException>(() => collection.Add(new RowStyle())); 65Assert.Throws<InvalidCastException>(() => collection[0]);
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (3)
133Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 192Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 201Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(TableLayoutPanelCellPosition), destinationType));
System\Windows\Forms\TableLayoutPanelTests.cs (2)
579Assert.Throws<NotSupportedException>(() => control.LayoutSettings = null); 588Assert.Throws<NotSupportedException>(() => control.LayoutSettings = otherControl.LayoutSettings);
System\Windows\Forms\TableLayoutRowStyleCollectionTests.cs (1)
65Assert.Throws<InvalidCastException>(() => collection[0]);
System\Windows\Forms\TableLayoutStyleCollectionTests.cs (2)
63Assert.Throws<InvalidCastException>(() => collection.Add(new object())); 169Assert.Throws<ArgumentException>(() => collection[0] = new object());
System\Windows\Forms\TableLayoutStyleTests.cs (3)
149Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new SubTableLayoutStyle { SizeType = sizeType }, typeof(InstanceDescriptor))); 163Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 172Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new RowStyle(), destinationType));
System\Windows\Forms\TabPageTests.cs (2)
2606Assert.Throws<ArgumentException>(() => control.Parent = control); 2615Assert.Throws<ArgumentException>(() => control.Parent = parent);
System\Windows\Forms\TaskDialogTests.cs (1)
48Assert.Throws<InvalidOperationException>(separateTask.GetAwaiter().GetResult);
System\Windows\Forms\ToolStripArrowRenderEventArgsTests.cs (1)
14Assert.Throws<ArgumentNullException>(() => new ToolStripArrowRenderEventArgs(null, toolStripButton, Rectangle.Empty, Color.Empty, ArrowDirection.Up));
System\Windows\Forms\ToolStripContentPanelRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripContentPanelRenderEventArgs(g, toolStripContentPanel));
System\Windows\Forms\ToolStripContentPanelTests.cs (1)
1429Assert.Throws<NotSupportedException>(() => control.RenderMode = ToolStripRenderMode.Custom);
System\Windows\Forms\ToolStripControlHostTests.cs (21)
160Assert.Throws<ObjectDisposedException>(() => item.AccessibleDefaultActionDescription = "value"); 190Assert.Throws<ObjectDisposedException>(() => item.AccessibleDescription = "value"); 220Assert.Throws<ObjectDisposedException>(() => item.AccessibleName = "value"); 259Assert.Throws<ObjectDisposedException>(() => item.BackColor); 325Assert.Throws<ObjectDisposedException>(() => item.BackColor = Color.Red); 393Assert.Throws<ObjectDisposedException>(() => item.BackgroundImage); 432Assert.Throws<ObjectDisposedException>(() => item.BackgroundImage = value); 442Assert.Throws<ObjectDisposedException>(() => item.BackgroundImageLayout); 472Assert.Throws<ObjectDisposedException>(() => item.BackgroundImageLayout = ImageLayout.Zoom); 845Assert.Throws<ObjectDisposedException>(() => item.Enabled); 930Assert.Throws<ObjectDisposedException>(() => item.Enabled = false); 940Assert.Throws<ObjectDisposedException>(() => item.Focused); 950Assert.Throws<ObjectDisposedException>(() => item.Font); 992Assert.Throws<ObjectDisposedException>(() => item.Font = font); 1078Assert.Throws<ObjectDisposedException>(() => item.ForeColor); 1144Assert.Throws<ObjectDisposedException>(() => item.ForeColor = Color.Red); 1534Assert.Throws<ObjectDisposedException>(() => item.Parent = parent); 2186Assert.Throws<ObjectDisposedException>(() => item.Site = mockSite.Object); 2758Assert.Throws<ObjectDisposedException>(() => item.GetPreferredSize(proposedSize)); 2761Assert.Throws<ObjectDisposedException>(() => item.GetPreferredSize(proposedSize)); 4365Assert.Throws<ObjectDisposedException>(() => item.ProcessMnemonic('a'));
System\Windows\Forms\ToolStripDropDownItemTests.cs (2)
466Assert.Throws<NullReferenceException>(() => item.DropDown); 467Assert.Throws<NullReferenceException>(() => item.DropDown);
System\Windows\Forms\ToolStripDropDownTests.cs (2)
281Assert.Throws<InvalidOperationException>(() => control.AllowItemReorder = true); 341Assert.Throws<ArgumentException>(() => control.AllowItemReorder = true);
System\Windows\Forms\ToolStripGripRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripGripRenderEventArgs(g, toolStrip));
System\Windows\Forms\ToolStripItemImageRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripItemImageRenderEventArgs(g, toolStripItem, Rectangle.Empty));
System\Windows\Forms\ToolStripItemRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripItemRenderEventArgs(g, toolStripItem));
System\Windows\Forms\ToolStripItemTests.cs (1)
763Assert.Throws<InvalidOperationException>(() => item.AllowDrop = true);
System\Windows\Forms\ToolStripMenuItemTests.cs (1)
145Assert.Throws<InvalidEnumArgumentException>(() => item.ShortcutKeys = keys);
System\Windows\Forms\ToolStripPanelRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripPanelRenderEventArgs(g, toolStripPanel));
System\Windows\Forms\ToolStripRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripRenderEventArgs(g, toolStrip));
System\Windows\Forms\ToolStripSeparatorRenderEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>(() => new ToolStripSeparatorRenderEventArgs(g, toolStripSeparator, true));
System\Windows\Forms\ToolStripTests.cs (7)
506Assert.Throws<InvalidOperationException>(() => control.AllowDrop = true); 577Assert.Throws<ArgumentException>(() => control.AllowDrop = true); 618Assert.Throws<InvalidOperationException>(() => control.AllowItemReorder = true); 678Assert.Throws<ArgumentException>(() => control.AllowItemReorder = true); 803Assert.Throws<NotSupportedException>(() => control.AutoScroll = value); 850Assert.Throws<NotSupportedException>(() => control.AutoScrollMinSize = new Size(1, 2)); 3440Assert.Throws<NotSupportedException>(() => control.RenderMode = ToolStripRenderMode.Custom);
System\Windows\Forms\TreeNodeCollectionTests.cs (3)
86Assert.Throws<ArgumentNullException>(() => collection[0] = null); 108Assert.Throws<ArgumentException>(() => collection[1] = node); 121Assert.Throws<ArgumentException>(() => collection[0] = nodeOfAnotherTreeView);
System\Windows\Forms\TreeNodeTests.cs (5)
23Assert.Throws<InvalidOperationException>(() => node.FullPath); 63Assert.Throws<InvalidOperationException>(() => node.FullPath); 111Assert.Throws<InvalidOperationException>(() => node.FullPath); 154Assert.Throws<InvalidOperationException>(() => node.FullPath); 202Assert.Throws<InvalidOperationException>(() => node.FullPath);
System\Windows\Forms\TreeViewTests.cs (1)
4745Assert.Throws<ArgumentException>(() => node.Nodes.Add(node));
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (3)
55Assert.Throws<ArgumentException>(() => new VisualStyleRenderer(element.ClassName, element.Part, element.State)); 73Assert.Throws<NullReferenceException>(() => new VisualStyleRenderer(null)); 80Assert.Throws<ArgumentException>(() => new VisualStyleRenderer(element));
System\Windows\Forms\WebBrowserTests.cs (38)
246Assert.Throws<ObjectDisposedException>(() => control.AllowWebBrowserDrop); 258Assert.Throws<InvalidOperationException>(() => control.AllowWebBrowserDrop); 332Assert.Throws<ObjectDisposedException>(() => control.AllowWebBrowserDrop = value); 345Assert.Throws<InvalidOperationException>(() => control.AllowWebBrowserDrop = value); 482Assert.Throws<ObjectDisposedException>(() => control.Document); 494Assert.Throws<InvalidOperationException>(() => control.Document); 550Assert.Throws<ObjectDisposedException>(() => control.DocumentStream); 562Assert.Throws<InvalidOperationException>(() => control.DocumentStream); 599Assert.Throws<ObjectDisposedException>(() => control.DocumentStream = null); 611Assert.Throws<InvalidOperationException>(() => control.DocumentStream = null); 667Assert.Throws<ObjectDisposedException>(() => control.DocumentText); 679Assert.Throws<InvalidOperationException>(() => control.DocumentText); 835Assert.Throws<ObjectDisposedException>(() => control.DocumentText = null); 847Assert.Throws<InvalidOperationException>(() => control.DocumentText = null); 904Assert.Throws<ObjectDisposedException>(() => control.DocumentTitle); 916Assert.Throws<InvalidOperationException>(() => control.DocumentTitle); 971Assert.Throws<ObjectDisposedException>(() => control.DocumentType); 983Assert.Throws<InvalidOperationException>(() => control.DocumentType); 1037Assert.Throws<ObjectDisposedException>(() => control.EncryptionLevel); 1049Assert.Throws<InvalidOperationException>(() => control.EncryptionLevel); 1146Assert.Throws<ObjectDisposedException>(() => control.IsBusy); 1158Assert.Throws<InvalidOperationException>(() => control.IsBusy); 1193Assert.Throws<ObjectDisposedException>(() => control.IsOffline); 1205Assert.Throws<InvalidOperationException>(() => control.IsOffline); 1578Assert.Throws<ArgumentException>(() => control.Parent = control); 1633Assert.Throws<ObjectDisposedException>(() => control.ReadyState); 1645Assert.Throws<InvalidOperationException>(() => control.ReadyState); 1680Assert.Throws<ObjectDisposedException>(() => control.ScriptErrorsSuppressed); 1692Assert.Throws<InvalidOperationException>(() => control.ScriptErrorsSuppressed); 1764Assert.Throws<ObjectDisposedException>(() => control.ScriptErrorsSuppressed = value); 1777Assert.Throws<InvalidOperationException>(() => control.ScriptErrorsSuppressed = value); 1884Assert.Throws<ObjectDisposedException>(() => control.StatusText); 1896Assert.Throws<InvalidOperationException>(() => control.StatusText); 1950Assert.Throws<ObjectDisposedException>(() => control.Url); 1962Assert.Throws<InvalidOperationException>(() => control.Url); 2088Assert.Throws<ArgumentException>(() => control.Url = relativeUri); 2100Assert.Throws<ObjectDisposedException>(() => control.Url = null); 2112Assert.Throws<InvalidOperationException>(() => control.Url = null);
TestAccessorTests.cs (2)
95Assert.Throws<RuntimeBinderException>(() => access.PublicField = 1918); 105Assert.Throws<RuntimeBinderException>(() => access.PublicProperty = "What?");
TextBoxBaseTests.cs (1)
2753Assert.Throws<ObjectDisposedException>(() => control.SelectedText = value);
WebBrowserBaseTests.cs (1)
856Assert.Throws<NotSupportedException>(() => control.UseWaitCursor = true);
System.Xaml.Tests (37)
System\Windows\Markup\ArrayExtensionTests.cs (3)
70Assert.Throws<RankException>(() => new ArrayExtension(new int[1, 1])); 108Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(null)); 116Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(null));
System\Windows\Markup\DateTimeValueSerializerTests.cs (2)
51Assert.Throws<NotSupportedException>(() => serializer.ConvertToString(value, null)); 83Assert.Throws<NotSupportedException>(() => serializer.ConvertFromString(null!, null));
System\Windows\Markup\NameReferenceConverterTests.cs (5)
85Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, "name")); 100Assert.Throws<InvalidCastException>(() => converter.ConvertFrom(context, null, "name")); 118Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, value)); 177Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(context, null, "value", null)); 192Assert.Throws<InvalidCastException>(() => converter.ConvertTo(context, null, "value", null));
System\Windows\Markup\ReferenceTests.cs (2)
79Assert.Throws<InvalidOperationException>(() => reference.ProvideValue(provider)); 92Assert.Throws<InvalidOperationException>(() => reference.ProvideValue(provider));
System\Windows\Markup\StaticExtensionTests.cs (7)
95Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(null)); 112Assert.Throws<ArgumentException>(() => extension.ProvideValue(provider)); 132Assert.Throws<ArgumentException>(() => extension.ProvideValue(provider)); 143Assert.Throws<ArgumentException>(() => extension.ProvideValue(null)); 165Assert.Throws<ArgumentException>(() => extension.ProvideValue(provider)); 235Assert.Throws<ArgumentException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 243Assert.Throws<NotSupportedException>(() => converter.ConvertTo(extension, typeof(int)));
System\Windows\Markup\StringValueSerializerTests.cs (1)
37Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(1, null));
System\Windows\Markup\TypeExtensionTests.cs (5)
83Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(null)); 103Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(provider)); 121Assert.Throws<InvalidOperationException>(() => extension.ProvideValue(provider)); 196Assert.Throws<ArgumentException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 204Assert.Throws<NotSupportedException>(() => converter.ConvertTo(extension, typeof(int)));
System\Windows\Markup\ValueSerializerTests.cs (12)
43Assert.Throws<NotSupportedException>(() => serializer.ConvertToString(value, null)); 44Assert.Throws<NotSupportedException>(() => serializer.ConvertToString(value, new CustomValueSerializerContext())); 67Assert.Throws<NotSupportedException>(() => serializer.ConvertFromString(null!, null)); 68Assert.Throws<NotSupportedException>(() => serializer.ConvertFromString(null!, new CustomValueSerializerContext())); 77Assert.Throws<NotSupportedException>(() => serializer.ConvertFromString(value, null)); 78Assert.Throws<NotSupportedException>(() => serializer.ConvertFromString(value, new CustomValueSerializerContext())); 213Assert.Throws<ArgumentException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithEmptyTypeConverterAttribute))); 214Assert.Throws<ArgumentException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithEmptyTypeConverterAttribute), null!)); 235Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithInvalidValueSerializerAttribute))); 236Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithInvalidValueSerializerAttribute), null)); 301Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(descriptor)); 302Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(descriptor, null));
WindowsBase.Tests (7)
System\Windows\SizeTests.cs (6)
11Assert.Throws<ArgumentException>(() => new Size(-1, 0)); 17Assert.Throws<ArgumentException>(() => new Size(0, -1)); 24Assert.Throws<InvalidOperationException>(() => size.Width = 0); 31Assert.Throws<InvalidOperationException>(() => size.Height = 0); 38Assert.Throws<ArgumentException>(() => size.Height = -1); 45Assert.Throws<ArgumentException>(() => size.Width = -1);
System\Windows\SplashScreenTests.cs (1)
11Assert.Throws<ArgumentNullException>(() => new SplashScreen(null));
xunit.assert (1)
ExceptionAsserts.cs (1)
166 var ex = Throws<T>(testCode);