1532 references to Throws
Binding.Http.IntegrationTests (3)
BasicHttpBindingTests.4.0.0.cs (1)
308Assert.Throws<FormatException>(() =>
NetHttpsBindingTests.4.1.0.cs (1)
63Assert.Throws<PlatformNotSupportedException>(() =>
OperationContextTests.cs (1)
52Assert.Throws<InvalidOperationException>(() => scope.Dispose());
Binding.UDS.IntegrationTests (1)
UDSBindingTests.cs (1)
197Assert.Throws<EndpointNotFoundException>(() => ((IChannel)serviceProxy).Open());
Client.ClientBase.IntegrationTests (6)
DuplexClientBaseTests.4.1.0.cs (2)
33var exception = Assert.Throws<InvalidOperationException>(() => 43Assert.Throws<CommunicationObjectFaultedException>(() =>
SessionTests.cs (4)
107Assert.Throws<InvalidOperationException>(() => 131Assert.Throws<InvalidOperationException>(() => 155Assert.Throws<InvalidOperationException>(() => 441Assert.Throws<CommunicationException>(() =>
Client.ExpectedExceptions.IntegrationTests (12)
ExpectedExceptionTests.4.0.0.cs (5)
28ActionNotSupportedException exception = Assert.Throws<ActionNotSupportedException>(() => 68TimeoutException exception = Assert.Throws<TimeoutException>(() => 115TimeoutException exception = Assert.Throws<TimeoutException>(() => 158FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 193FaultException<ExceptionDetail> exception = Assert.Throws<FaultException<ExceptionDetail>>(() =>
ExpectedExceptionTests.4.1.0.cs (6)
28EndpointNotFoundException exception = Assert.Throws<EndpointNotFoundException>(() => 130CommunicationException exception = Assert.Throws<CommunicationException>(() => 160EndpointNotFoundException exception = Assert.Throws<EndpointNotFoundException>(() => 199ProtocolException exception = Assert.Throws<ProtocolException>(() => 239FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 291FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() =>
ExpectedExceptionTests.4.1.1.cs (1)
27var exception = Assert.Throws<Exception>(() =>
Contract.Fault.IntegrationTests (6)
FaultExceptionTests.4.0.0.cs (6)
24FaultException<FaultDetail> exception = Assert.Throws<FaultException<FaultDetail>>(() => 58FaultException<ExceptionDetail> exception = Assert.Throws<FaultException<ExceptionDetail>>(() => 101thrownException = Assert.Throws<FaultException<int>>(() => 130var exception = Assert.Throws<FaultException<FaultDetail>>(() => 167var exception = Assert.Throws<FaultException<FaultDetail2>>(() => 204var exception = Assert.Throws<FaultException<FaultDetail>>(() =>
Contract.Message.IntegrationTests (1)
MessageContractTests.cs (1)
57Assert.Throws<ProtocolException>(() =>
Contract.Service.IntegrationTests (2)
ServiceContractTests.4.1.0.cs (2)
276Assert.Throws<TimeoutException>(() => 332Assert.Throws<TimeoutException>(() =>
Encoding.Encoders.IntegrationTests (1)
TextEncodingTests.4.1.0.cs (1)
31Assert.Throws<ProtocolException>(() => { serviceProxy.ReturnContentType(testContentType); });
InMemory.FunctionalTests (40)
Http2\Http2StreamTests.cs (12)
1519ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 2144Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 2146Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 2147Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 2185Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 2186Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 2469Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 2470Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value")); 2471Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 2512Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 2513Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 5386var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
Http3\Http3StreamTests.cs (11)
864Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 866Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 867Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 898Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 899Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 1015Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 1016Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value")); 1017Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 1046Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value")); 1047Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value")); 1664var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
RequestTests.cs (2)
1701var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null)); 1794var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null));
ResponseHeaderTests.cs (5)
23Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 26Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value")); 27Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value")); 54Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value")); 55Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
ResponseTests.cs (10)
83ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 117ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); 1174completeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Complete()); 3612var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); 3708var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); 3771Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); 3802Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); 3832Assert.Throws<InvalidOperationException>(() => response.BodyWriter.Advance(1)); 4261Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1)); 4432Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1));
Interop.FunctionalTests (2)
Http3\Http3TlsTests.cs (2)
393Assert.Throws<InvalidOperationException>(host.Run); 426Assert.Throws<InvalidOperationException>(host.Run);
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
89Assert.Throws<ArgumentNullException>(() => a.Initialize(null!));
Microsoft.AspNetCore.Antiforgery.Test (1)
DefaultAntiforgeryTest.cs (1)
121var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.AsyncState.Tests (1)
AsyncContextHttpContextOfTTests.cs (1)
71Assert.Throws<InvalidOperationException>(() => _context.Set(value));
Microsoft.AspNetCore.Authentication.Negotiate.Test (2)
LdapSettingsValidationTests.cs (2)
16Assert.Throws<ArgumentNullException>(() => settings.Validate()); 28Assert.Throws<ArgumentNullException>(() => settings.Validate());
Microsoft.AspNetCore.Authorization.Test (1)
AuthorizationAppBuilderExtensionsTests.cs (1)
52var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Components.Authorization.Tests (3)
AuthorizeViewTest.cs (2)
244var ex = Assert.Throws<InvalidOperationException>(() => 492var ex = Assert.Throws<NotSupportedException>(rootComponent.TriggerRender);
CascadingAuthenticationStateTest.cs (1)
28var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender());
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
Buffering\BufferedTextWriterTest.cs (1)
12Assert.Throws<NotSupportedException>(writer.Flush);
Microsoft.AspNetCore.Components.Server.Tests (6)
Circuits\RemoteJSRuntimeTest.cs (3)
33var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(id: 0, data)); 73var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(5, new byte[] { 0 })); 85var ex = Assert.Throws<ArgumentOutOfRangeException>(() => jsRuntime.TestReceiveByteArray(1, new byte[5000]));
Circuits\RemoteRendererTest.cs (1)
613var ex = Assert.Throws<InvalidOperationException>(() => renderer.GetOrCreateWebRootComponentManager().RemoveRootComponent(1));
ElementReferenceJsonConverterTest.cs (2)
84var ex = Assert.Throws<JsonException>(() => 103var ex = Assert.Throws<JsonException>(() =>
Microsoft.AspNetCore.Components.Tests (71)
CascadingParameterTest.cs (3)
325var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender()); 350var ex = Assert.Throws<InvalidOperationException>(() => component.TriggerRender()); 384var ex = Assert.Throws<InvalidOperationException>(nestedComponent.AttemptIllegalAccessToLastParameterView);
DependencyInjectionTest.cs (3)
44var ex = Assert.Throws<InvalidOperationException>(() => 57var ex = Assert.Throws<InvalidOperationException>(() => 73var ex = Assert.Throws<InvalidOperationException>(() =>
DynamicComponentTest.cs (2)
14var ex = Assert.Throws<InvalidOperationException>(() => 35var ex = Assert.Throws<InvalidOperationException>(
NavigationManagerTest.cs (2)
59var ex = Assert.Throws<ArgumentException>(() => 77var ex = Assert.Throws<ArgumentException>(() =>
ParameterViewTest.Assignment.cs (15)
159var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 179var ex = Assert.Throws<InvalidOperationException>( 201var ex = Assert.Throws<InvalidOperationException>( 238var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 257var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 276var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 381var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 405var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 424var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 445var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 491var ex = Assert.Throws<InvalidOperationException>(() => parameters.SetParameterProperties(target)); 512var ex = Assert.Throws<InvalidOperationException>( 533var ex = Assert.Throws<InvalidOperationException>( 551var ex = Assert.Throws<InvalidOperationException>(() => 574var ex = Assert.Throws<InvalidOperationException>(() =>
ParameterViewTest.cs (2)
232Assert.Throws<InvalidCastException>(() => 338Assert.Throws<InvalidOperationException>(() => parameterView.SetParameterProperties(new object()));
PersistentState\ComponentApplicationStateTest.cs (2)
41Assert.Throws<InvalidOperationException>(() => applicationState.InitializeExistingState(existingState)); 110Assert.Throws<ArgumentException>(() => applicationState.PersistAsJson("MyState", myState));
RendererTest.cs (8)
2924var ex = Assert.Throws<InvalidOperationException>(component.TriggerRender); 4430var ex = Assert.Throws<InvalidOperationException>( 4460Assert.Throws<InvalidOperationException>(() => parameterView.SetParameterProperties(new object())); 4828var ex = Assert.Throws<ArgumentException>(() => 4854var ex = Assert.Throws<ArgumentException>(() => 4883var ex = Assert.Throws<InvalidOperationException>(() => 5043var ex = Assert.Throws<NotSupportedException>(() => component.TriggerRender()); 5061var ex = Assert.Throws<NotSupportedException>(component.TriggerRender);
Rendering\RendererSynchronizationContextTest.cs (1)
318Assert.Throws<InvalidTimeZoneException>(() => context.Send((_) =>
Rendering\RenderTreeBuilderTest.cs (30)
435Assert.Throws<InvalidOperationException>(() => 448Assert.Throws<InvalidOperationException>(() => 461Assert.Throws<InvalidOperationException>(() => 474Assert.Throws<InvalidOperationException>(() => 489Assert.Throws<InvalidOperationException>(() => 504Assert.Throws<InvalidOperationException>(() => 519Assert.Throws<InvalidOperationException>(() => 533Assert.Throws<InvalidOperationException>(() => 547Assert.Throws<InvalidOperationException>(() => 562Assert.Throws<InvalidOperationException>(() => 577Assert.Throws<InvalidOperationException>(() => 592Assert.Throws<InvalidOperationException>(() => 738Assert.Throws<InvalidOperationException>(() => 751Assert.Throws<InvalidOperationException>(() => 765Assert.Throws<InvalidOperationException>(() => 827Assert.Throws<InvalidOperationException>(() => 840Assert.Throws<InvalidOperationException>(() => 854Assert.Throws<InvalidOperationException>(() => 1747var ex = Assert.Throws<InvalidOperationException>(() => 1763var ex = Assert.Throws<InvalidOperationException>(() => 2049var ex = Assert.Throws<InvalidOperationException>(() => builder.AssertTreeIsValid(component)); 2064var ex = Assert.Throws<InvalidOperationException>(() => builder.AssertTreeIsValid(component)); 2079var ex = Assert.Throws<InvalidOperationException>(() => builder.AssertTreeIsValid(component)); 2136var ex = Assert.Throws<InvalidOperationException>(() => 2175var ex = Assert.Throws<InvalidOperationException>(() => 2211var ex = Assert.Throws<InvalidOperationException>(() => 2226var ex = Assert.Throws<ArgumentNullException>(() => 2241var ex = Assert.Throws<ArgumentNullException>(() => 2256var ex = Assert.Throws<ArgumentException>(() => 2272var ex = Assert.Throws<InvalidOperationException>(() =>
RouteViewTest.cs (1)
35var ex = Assert.Throws<InvalidOperationException>(() =>
StackObjectPoolTest.cs (2)
96var ex = Assert.Throws<InvalidOperationException>(() => 112var ex = Assert.Throws<ArgumentException>(() =>
Microsoft.AspNetCore.Components.Web.Tests (6)
Forms\InputBaseTest.cs (1)
21var ex = Assert.Throws<InvalidOperationException>(() => rootComponent.TriggerRender());
Forms\Mapping\FormMappingScopeTest.cs (3)
91var exception = Assert.Throws<InvalidOperationException>(() => _renderer.RenderRootComponent(id)); 106var exception = Assert.Throws<InvalidOperationException>(() => _renderer.RenderRootComponent(id)); 129var exception = Assert.Throws<InvalidOperationException>(testComponent.TriggerRender);
HtmlRendering\HtmlRendererTest.cs (2)
42var ex = Assert.Throws<InvalidOperationException>(() => htmlContent.WriteHtmlTo(new StringWriter())); 935var ex = Assert.Throws<InvalidTimeZoneException>(() =>
Microsoft.AspNetCore.Components.WebAssembly.Tests (1)
Hosting\WebAssemblyCultureProviderTest.cs (1)
40var ex = Assert.Throws<InvalidOperationException>(() => cultureProvider.ThrowIfCultureChangeIsUnsupported());
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
PolicyTests\StackPolicyTests.cs (2)
143Assert.Throws<InvalidOperationException>(() => stack.OnExit()); 149Assert.Throws<InvalidOperationException>(() => stack.OnExit());
Microsoft.AspNetCore.CookiePolicy.Test (5)
CookieConsentTests.cs (1)
331Assert.Throws<InvalidOperationException>(() => context.Response.Cookies.Append("Test", "Value"));
CookiePolicyTests.cs (4)
338Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A")); 339Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A", new CookieOptions())); 340Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A")); 341Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A", new CookieOptions()));
Microsoft.AspNetCore.Cors.Test (2)
CorsPolicyTests.cs (1)
48var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
CorsResultTests.cs (1)
30var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Microsoft.AspNetCore.Cryptography.Internal.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.DataProtection.Abstractions.Tests (3)
DataProtectionCommonExtensionsTests.cs (3)
250var ex = Assert.Throws<CryptographicException>(() => 278var ex = Assert.Throws<CryptographicException>(() => 292var ex = Assert.Throws<CryptographicException>(() =>
Microsoft.AspNetCore.DataProtection.Extensions.Tests (1)
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.DataProtection.Tests (18)
Cng\CbcAuthenticatedEncryptorTests.cs (4)
52Assert.Throws<CryptographicException>(() => 61Assert.Throws<CryptographicException>(() => 69Assert.Throws<CryptographicException>(() => 76Assert.Throws<CryptographicException>(() =>
Cng\GcmAuthenticatedEncryptorTests.cs (4)
46Assert.Throws<CryptographicException>(() => 55Assert.Throws<CryptographicException>(() => 63Assert.Throws<CryptographicException>(() => 70Assert.Throws<CryptographicException>(() =>
Internal\KeyManagementOptionsPostSetupTest.cs (1)
168Assert.Throws<InvalidOperationException>(() => repository.StoreElement(xElement, friendlyName: null));
KeyManagement\AdditionalAuthenticatedDataTemplateTests.cs (1)
43Assert.Throws<EncoderFallbackException>(() =>
Managed\ManagedAuthenticatedEncryptorTests.cs (4)
47Assert.Throws<CryptographicException>(() => 56Assert.Throws<CryptographicException>(() => 64Assert.Throws<CryptographicException>(() => 71Assert.Throws<CryptographicException>(() =>
SecretTests.cs (2)
218Assert.Throws<ObjectDisposedException>( 259Assert.Throws<ObjectDisposedException>(
ServiceCollectionTests.cs (1)
102Assert.Throws<InvalidOperationException>(() => repository.StoreElement(xElement, friendlyName: null));
src\DataProtection\shared\test\ExceptionAssert2.cs (1)
20return Assert.Throws<CryptographicException>(testCode);
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (2)
HealthCheckEndpointRouteBuilderExtensionsTest.cs (1)
38var ex = Assert.Throws<InvalidOperationException>(() => host.Start());
HealthCheckMiddlewareTests.cs (1)
33var ex = Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Diagnostics.Tests (1)
ExceptionHandlerTest.cs (1)
526var exception = Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Hosting.Tests (9)
ConfigureBuilderTests.cs (1)
26var ex = Assert.Throws<InvalidOperationException>(() => action.Invoke(applicationBuilder));
StartupManagerTests.cs (2)
514Assert.Throws<InvalidOperationException>(() => startup.ConfigureDelegate(app)); 543Assert.Throws<Exception>(() => startup.ConfigureDelegate(app));
WebHostBuilderTests.cs (6)
233Assert.Throws<InvalidOperationException>(() => host.Start()); 261Assert.Throws<InvalidOperationException>(() => host.Start()); 714var ex = Assert.Throws<InvalidOperationException>(() => 1012var exception = Assert.Throws<NotSupportedException>(() => 1033var exception = Assert.Throws<NotSupportedException>(() => 1251Assert.Throws<InvalidOperationException>(() => host.Start());
Microsoft.AspNetCore.Http.Abstractions.Tests (7)
EndpointFilterInvocationContextOfTTests.cs (4)
13Assert.Throws<NotSupportedException>(() => context.Add("string")); 14Assert.Throws<NotSupportedException>(() => context.Insert(0, "string")); 15Assert.Throws<NotSupportedException>(() => context.RemoveAt(0)); 17Assert.Throws<NotSupportedException>(() => context.Clear());
RouteValueDictionaryTests.cs (1)
352var exception = Assert.Throws<InvalidOperationException>(() =>
UseWhenExtensionsTests.cs (2)
21Assert.Throws<ArgumentNullException>(nullPredicate); 22Assert.Throws<ArgumentNullException>(nullConfiguration);
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ResponseExtensionTests.cs (1)
31Assert.Throws<InvalidOperationException>(() => context.Response.Clear());
UriHelperTests.cs (1)
192Assert.Throws<ArgumentNullException>(() => UriHelper.FromAbsolute(null, out resScheme, out resHost, out resPath, out resQuery, out resFragment));
Microsoft.AspNetCore.Http.Tests (7)
HeaderDictionaryTests.cs (3)
96Assert.Throws<InvalidOperationException>(() => headers.Add(new KeyValuePair<string, StringValues>("header1", "value1"))); 97Assert.Throws<InvalidOperationException>(() => headers.Add("header1", "value1")); 98Assert.Throws<InvalidOperationException>(() => headers.Clear());
Internal\ReferenceReadStreamTests.cs (3)
35Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 42Assert.Throws<NotSupportedException>(() => stream.Write(new byte[1], 0, 1)); 49Assert.Throws<NotSupportedException>(() => stream.WriteByte(0));
ResponseCookiesTest.cs (1)
270Assert.Throws<ArgumentException>(() => cookies.Append(key, "1"));
Microsoft.AspNetCore.HttpsPolicy.Tests (2)
HstsMiddlewareTests.cs (2)
24Assert.Throws<ArgumentNullException>(() => 33Assert.Throws<ArgumentNullException>(() =>
Microsoft.AspNetCore.Identity.Test (2)
PasswordHasherTest.cs (2)
29var ex = Assert.Throws<InvalidOperationException>(() => 42var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.InternalTesting.Tests (2)
LogValuesAssertTest.cs (2)
119var equalException = Assert.Throws<EqualException>( 207var equalException = Assert.Throws<EqualException>(
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests (19)
IntegrationTests\AnonymousObjectIntegrationTest.cs (6)
21var exception = Assert.Throws<JsonPatchException>(() => 44var exception = Assert.Throws<JsonPatchException>(() => 67var exception = Assert.Throws<JsonPatchException>(() => 91var exception = Assert.Throws<JsonPatchException>(() => 115var exception = Assert.Throws<JsonPatchException>(() => 156var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\DictionaryIntegrationTest.cs (1)
168var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\ListIntegrationTest.cs (3)
48var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); }); 160var exception = Assert.Throws<JsonPatchException>(() => 248var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); });
IntegrationTests\SimpleObjectIntegrationTest.cs (1)
164var ex = Assert.Throws<JsonPatchException>(() => document.ApplyTo(target));
Internal\ParsedPathTests.cs (1)
36Assert.Throws<JsonPatchException>(() =>
JsonPatchDocumentGetPathTest.cs (1)
97var exception = Assert.Throws<InvalidOperationException>(() =>
JsonPatchDocumentJObjectTest.cs (1)
41Assert.Throws<JsonPatchException>(() => patch.ApplyTo(model));
JsonPatchDocumentTest.cs (5)
23var exception = Assert.Throws<JsonPatchException>(() => 41var exception = Assert.Throws<JsonPatchException>(() => 174var exception = Assert.Throws<JsonException>(() => 191var exception = Assert.Throws<JsonException>(() => 231Assert.Throws<JsonPatchException>(() =>
Microsoft.AspNetCore.JsonPatch.Tests (27)
IntegrationTests\AnonymousObjectIntegrationTest.cs (7)
21var exception = Assert.Throws<JsonPatchException>(() => 45var exception = Assert.Throws<JsonPatchException>(() => 68var exception = Assert.Throws<JsonPatchException>(() => 91var exception = Assert.Throws<JsonPatchException>(() => 115var exception = Assert.Throws<JsonPatchException>(() => 139var exception = Assert.Throws<JsonPatchException>(() => 180var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\DictionaryIntegrationTest.cs (1)
168var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\DynamicObjectIntegrationTest.cs (3)
60var exception = Assert.Throws<JsonPatchException>(() => 160var exception = Assert.Throws<JsonPatchException>(() => 225var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\ExpandoObjectIntegrationTest.cs (5)
147var exception = Assert.Throws<JsonPatchException>(() => 168var exception = Assert.Throws<JsonPatchException>(() => 272var exception = Assert.Throws<JsonPatchException>(() => 312var exception = Assert.Throws<JsonPatchException>(() => 354var exception = Assert.Throws<JsonPatchException>(() =>
IntegrationTests\ListIntegrationTest.cs (3)
48var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); }); 160var exception = Assert.Throws<JsonPatchException>(() => 248var exception = Assert.Throws<JsonPatchException>(() => { patchDocument.ApplyTo(targetObject); });
IntegrationTests\SimpleObjectIntegrationTest.cs (1)
164var ex = Assert.Throws<JsonPatchException>(() => document.ApplyTo(target));
Internal\ParsedPathTests.cs (1)
36Assert.Throws<JsonPatchException>(() =>
JsonPatchDocumentGetPathTest.cs (1)
97var exception = Assert.Throws<InvalidOperationException>(() =>
JsonPatchDocumentJObjectTest.cs (1)
43Assert.Throws<JsonPatchException>(() => patch.ApplyTo(model));
JsonPatchDocumentTest.cs (4)
19var exception = Assert.Throws<JsonPatchException>(() => 37var exception = Assert.Throws<JsonPatchException>(() => 135var exception = Assert.Throws<JsonSerializationException>(() => 152var exception = Assert.Throws<JsonSerializationException>(() =>
Microsoft.AspNetCore.Mvc.Abstractions.Test (5)
ModelBinding\ModelStateDictionaryTest.cs (5)
193var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldSkipped("key")); 252var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldValid("key")); 1687var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.SetModelValue(key, string.Empty, string.Empty)); 1705var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldValid(key)); 1723var exception = Assert.Throws<InvalidOperationException>(() => source.MarkFieldSkipped(key));
Microsoft.AspNetCore.Mvc.Core.Test (20)
ApplicationModels\ApiBehaviorApplicationModelProviderTest.cs (1)
36var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context));
ApplicationModels\AttributeRouteModelTests.cs (2)
170var ex = Assert.Throws<InvalidOperationException>( 197var ex = Assert.Throws<InvalidOperationException>(
ApplicationModels\ControllerActionDescriptorProviderTests.cs (3)
437var ex = Assert.Throws<InvalidOperationException>(() => { provider.GetDescriptors(); }); 761var ex = Assert.Throws<InvalidOperationException>(() => { provider.GetDescriptors(); }); 882var ex = Assert.Throws<InvalidOperationException>(() => { provider.GetDescriptors(); });
ApplicationModels\InferParameterBindingInfoConventionTest.cs (3)
67var ex = Assert.Throws<InvalidOperationException>(() => convention.InferParameterBindingSources(action)); 86var ex = Assert.Throws<InvalidOperationException>(() => convention.InferParameterBindingSources(action)); 105var ex = Assert.Throws<InvalidOperationException>(() => convention.InferParameterBindingSources(action));
Builder\MvcApplicationBuilderExtensionsTest.cs (1)
71var ex = Assert.Throws<InvalidOperationException>(() =>
Filters\MiddlewareFilterConfigurationProviderTest.cs (2)
70var exception = Assert.Throws<InvalidOperationException>(() => 86var exception = Assert.Throws<InvalidOperationException>(() =>
Filters\ResponseCacheFilterExecutorTest.cs (2)
59var ex = Assert.Throws<InvalidOperationException>(() => executor.Execute(context)); 428var exception = Assert.Throws<InvalidOperationException>(() => executor.Execute(context));
Infrastructure\ActionSelectorTest.cs (2)
511Assert.Throws<AmbiguousActionException>(() => { selector.SelectBestCandidate(routeContext, actions); }); 838var ex = Assert.Throws<AmbiguousActionException>(() =>
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
1095Assert.Throws<InvalidTimeZoneException>( 1279var ex = Assert.Throws<InvalidOperationException>(() => validator.Validate(actionContext, validationState, prefix: string.Empty, model));
ResponseCacheAttributeTest.cs (1)
314var exception = Assert.Throws<InvalidOperationException>(() =>
Routing\AttributeRouteTest.cs (1)
532var exception = Assert.Throws<RouteCreationException>(() =>
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (3)
XmlAssertTest.cs (3)
20var equalException = Assert.Throws<EqualException>(() => XmlAssert.Equal(input1, input2)); 72Assert.Throws<EqualException>(() => XmlAssert.Equal(input1, input2)); 113var equalException = Assert.Throws<EqualException>(() => XmlAssert.Equal(expected, actual));
Microsoft.AspNetCore.Mvc.Localization.Test (1)
HtmlLocalizerTest.cs (1)
148var exception = Assert.Throws<FormatException>(
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
BsonTempDataSerializerTest.cs (2)
32var exception = Assert.Throws<InvalidOperationException>(() => 60var exception = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Mvc.Razor.Test (5)
ApplicationParts\RazorCompiledItemFeatureProviderTest.cs (1)
107var ex = Assert.Throws<InvalidOperationException>(() => featureProvider.PopulateFeature(new[] { part1, part2.Object }, feature));
RazorPageActivatorTest.cs (1)
166Assert.Throws<InvalidCastException>(() => activator.Activate(instance, viewContext));
RazorPageTest.cs (2)
665var ex = Assert.Throws<InvalidOperationException>(() => page.EnsureRenderedBodyOrSections()); 704var ex = Assert.Throws<InvalidOperationException>(() => page.EnsureRenderedBodyOrSections());
TagHelpers\UrlResolutionTagHelperTest.cs (1)
380var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.Mvc.RazorPages.Test (6)
ApplicationModels\DefaultPageApplicationModelProviderTest.cs (4)
27var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context)); 68var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context)); 91var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context)); 116var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context));
ApplicationModels\TempDataFilterPageApplicationModelProviderTest.cs (2)
40var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context)); 57var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context));
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
InputTagHelperTest.cs (2)
149var ex = Assert.Throws<InvalidOperationException>(() => tagHelper.Process(context, output)); 196var ex = Assert.Throws<InvalidOperationException>(() => tagHelper.Process(context, output));
TagHelperOutputExtensionsTest.cs (2)
1053var exceptionAdd = Assert.Throws<ArgumentException>(() => tagHelperOutput.AddClass(classValue, htmlEncoder)); 1054var exceptionRemove = Assert.Throws<ArgumentException>(() => tagHelperOutput.RemoveClass(classValue, htmlEncoder));
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (12)
AttributeDictionaryTest.cs (1)
59Assert.Throws<InvalidOperationException>(() => attributes.Add("one", "15"));
Filters\AntiforgeryApplicationModelProviderTest.cs (1)
136var exception = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context));
Filters\TempDataApplicationModelProviderTest.cs (2)
42var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context)); 59var ex = Assert.Throws<InvalidOperationException>(() => provider.OnProvidersExecuting(context));
Rendering\HtmlHelperPartialExtensionsTest.cs (1)
176var actual = Assert.Throws<InvalidOperationException>(() => partialMethod(helper.Object));
SessionStateTempDataProviderTest.cs (2)
26Assert.Throws<InvalidOperationException>(() => 39Assert.Throws<InvalidOperationException>(() =>
ViewComponents\ViewViewComponentResultTest.cs (3)
175var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext)); 213var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext)); 253var ex = Assert.Throws<InvalidOperationException>(() => result.Execute(viewComponentContext));
ViewDataDictionaryTest.cs (2)
141var exception = Assert.Throws<InvalidOperationException>(() => viewData.SetModelPublic(model)); 402var exception = Assert.Throws<InvalidOperationException>(() => viewData.SetModelPublic(value: null));
Microsoft.AspNetCore.OutputCaching.Tests (1)
OutputCacheKeyProviderTests.cs (1)
299Assert.Throws<ArgumentException>(() =>
Microsoft.AspNetCore.Owin.Tests (3)
OwinEnvironmentTests.cs (3)
149Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null, 0)); // array is null 150Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(kvp, -1)); // arrayIndex is less than 0 151Assert.Throws<ArgumentException>(() => collection.CopyTo(kvp, 1)); // The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.
Microsoft.AspNetCore.Razor.Runtime.Test (1)
Runtime\TagHelpers\TagHelperScopeManagerTest.cs (1)
215var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.RequestDecompression.Tests (9)
DefaultRequestDecompressionProviderTests.cs (2)
139Assert.Throws<ArgumentNullException>(() => 153Assert.Throws<ArgumentNullException>(() =>
RequestDecompressionBuilderExtensionsTests.cs (1)
17Assert.Throws<ArgumentNullException>(() =>
RequestDecompressionMiddlewareTests.cs (3)
606Assert.Throws<ArgumentNullException>(() => 621Assert.Throws<ArgumentNullException>(() => 637Assert.Throws<ArgumentNullException>(() =>
RequestDecompressionServiceExtensionsTests.cs (2)
18Assert.Throws<ArgumentNullException>(() => 32Assert.Throws<ArgumentNullException>(() =>
SizeLimitedStreamTests.cs (1)
15Assert.Throws<ArgumentNullException>(() =>
Microsoft.AspNetCore.Rewrite.Tests (1)
ApacheModRewrite\RuleBuilderTest.cs (1)
20var ex = Assert.Throws<NotSupportedException>(() => builder.AddAction(null, flags));
Microsoft.AspNetCore.Routing.Tests (12)
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
470Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo"))));
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (1)
500Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo"))));
DefaultInlineConstraintResolverTest.cs (1)
290var ex = Assert.Throws<InvalidOperationException>(() => routeOptions.SetParameterPolicy("custom", typeof(string)));
Matching\CandidateSetTest.cs (1)
321var ex = Assert.Throws<InvalidOperationException>(() => candidateSet.ExpandEndpoint(0, Array.Empty<Endpoint>(), comparer));
Matching\DataSourceDependentMatcherTest.cs (1)
225var exception = Assert.Throws<AggregateException>(
Matching\HostMatcherPolicyTest.cs (2)
97Assert.Throws<InvalidOperationException>(() => 189Assert.Throws<InvalidOperationException>(() =>
Patterns\RoutePatternFactoryTest.cs (2)
305Assert.Throws<InvalidOperationException>(() => 608var exception = Assert.Throws<InvalidOperationException>(() =>
Template\RoutePrecedenceTestsBase.cs (2)
101var ex = Assert.Throws<InvalidOperationException>(() => 114var ex = Assert.Throws<InvalidOperationException>(() =>
TemplateParserDefaultValuesTests.cs (1)
108var ex = Assert.Throws<RouteCreationException>(() =>
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (19)
DelegateTests.cs (2)
92Assert.Throws<InvalidOperationException>(() => delegateFeature.DelegateRequest(destination)); 158Assert.Throws<InvalidOperationException>(() => delegateFeature.DelegateRequest(destination));
Listener\ResponseBodyTests.cs (4)
31Assert.Throws<InvalidOperationException>(() => context.Response.Body.Flush()); 32Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(new byte[10], 0, 10)); 33Assert.Throws<InvalidOperationException>(() => context.Response.Body.Flush()); 261Assert.Throws<ObjectDisposedException>(() => context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length));
Listener\ResponseHeaderTests.cs (5)
305Assert.Throws<InvalidOperationException>(() => 310Assert.Throws<InvalidOperationException>(() => 315Assert.Throws<InvalidOperationException>(() => 320Assert.Throws<InvalidOperationException>(() => 326Assert.Throws<InvalidOperationException>(() =>
Listener\ServerTests.cs (1)
138var exception = Assert.Throws<HttpSysException>(() => listener.Start());
RequestBodyLimitTests.cs (2)
190var ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); }); 193ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
ResponseHeaderTests.cs (2)
229Assert.Throws<InvalidOperationException>(() => responseHeaders.Add("Custom3", new string[] { "value3a, value3b", "value3c" })); 260Assert.Throws<InvalidOperationException>(() => responseHeaders.Add("Custom3", new string[] { "value3a, value3b", "value3c" }));
ResponseTests.cs (1)
205Assert.Throws<InvalidTimeZoneException>(() => httpContext.Response.Body.Write(new byte[10], 0, 10));
ResponseTrailersTests.cs (2)
66Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer(header, "value")); 128Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer("TrailerName", "Trailer Value"));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (92)
BodyControlTests.cs (12)
95Assert.Throws<Exception>(() => requestPipe.AdvanceTo(new SequencePosition()))); 97Assert.Throws<Exception>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition()))); 99Assert.Throws<Exception>(() => requestPipe.CancelPendingRead())); 103Assert.Throws<Exception>(() => requestPipe.Complete())); 115Assert.Throws<ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition())); 116Assert.Throws<ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition())); 117Assert.Throws<ObjectDisposedException>(() => requestPipe.CancelPendingRead()); 119Assert.Throws<ObjectDisposedException>(() => requestPipe.Complete()); 132Assert.Throws<ObjectDisposedException>(() => responsePipe.Advance(1)); 133Assert.Throws<ObjectDisposedException>(() => responsePipe.CancelPendingFlush()); 135Assert.Throws<ObjectDisposedException>(() => responsePipe.GetSpan()); 136Assert.Throws<ObjectDisposedException>(() => responsePipe.Complete());
DiagnosticMemoryPoolTests.cs (5)
22var exception = Assert.Throws<InvalidOperationException>(() => memoryPool.Dispose()); 33var exception = Assert.Throws<InvalidOperationException>(() => block.Dispose()); 43var exception = Assert.Throws<InvalidOperationException>(() => block.Dispose()); 218var exception = Assert.Throws<InvalidOperationException>(() => memoryPool.Dispose()); 224var exception = Assert.Throws<AggregateException>(() => memoryPool.Dispose());
Http1\Http1ConnectionTests.cs (1)
325Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)_http1Connection).OnStarting(_ => Task.CompletedTask, null));
HttpParserTests.cs (10)
332Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 384Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 487var exception = Assert.Throws<BadHttpRequestException>(() => 507var exception = Assert.Throws<BadHttpRequestException>(() => 550exception = Assert.Throws<BadHttpRequestException>(() => 586var badHttpRequestException = Assert.Throws<BadHttpRequestException>(() => 605var exception = Assert.Throws<BadHttpRequestException>(() => 625var exception = Assert.Throws<BadHttpRequestException>(() => 787var exception = Assert.Throws<BadHttpRequestException>(() => 811var exception = Assert.Throws<BadHttpRequestException>(() =>
HttpRequestHeadersTests.cs (8)
299Assert.Throws<ArgumentException>(() => headers.Add("host", new[] { "localhost" })); 300Assert.Throws<ArgumentException>(() => headers.Add("custom", new[] { "value" })); 301Assert.Throws<ArgumentException>(() => headers.Add("Content-Length", new[] { "0" })); 401var exception = Assert.Throws<BadHttpRequestException>( 562Assert.Throws<InvalidOperationException>((Action)(() => 654Assert.Throws<InvalidOperationException>(() => 685Assert.Throws<InvalidOperationException>(() => headers.Append(acceptNameBytes, headerValueBytes, checkForNewlineChars: false)); 709Assert.Throws<InvalidOperationException>(() =>
HttpRequestStreamTests.cs (4)
57Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 72Assert.Throws<NotSupportedException>(() => stream.Write(new byte[1], 0, 1)); 79Assert.Throws<NotSupportedException>(() => stream.WriteByte(0)); 123var ioEx2 = Assert.Throws<InvalidOperationException>(() => stream.CopyTo(Stream.Null));
HttpResponseHeadersTests.cs (17)
110Assert.Throws<InvalidOperationException>(() => 115Assert.Throws<InvalidOperationException>(() => 120Assert.Throws<InvalidOperationException>(() => 125Assert.Throws<InvalidOperationException>(() => 131Assert.Throws<InvalidOperationException>(() => 155Assert.Throws<InvalidOperationException>(() => 161Assert.Throws<InvalidOperationException>(() => 193Assert.Throws<InvalidOperationException>(() => 199Assert.Throws<InvalidOperationException>(() => 204Assert.Throws<InvalidOperationException>(() => 209Assert.Throws<InvalidOperationException>(() => 214Assert.Throws<InvalidOperationException>(() => 219Assert.Throws<InvalidOperationException>(() => 225Assert.Throws<InvalidOperationException>(() => 267Assert.Throws<InvalidOperationException>(() => ((IDictionary<string, StringValues>)headers).Add("my-header", new[] { "value" })); 309Assert.Throws<InvalidOperationException>(() => dictionary.Clear()); 319var exception = Assert.Throws<InvalidOperationException>(() => dictionary.Add("Content-Length", new[] { contentLength }));
HttpResponsePipeWriterTests.cs (6)
19var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.Advance(1); }); 29var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.GetMemory(); }); 39var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.GetSpan(); }); 49var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.Complete(); }); 59var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.FlushAsync(); }); 69var ex = Assert.Throws<ObjectDisposedException>(() => { pipeWriter.WriteAsync(new Memory<byte>()); });
HttpResponseStreamTests.cs (2)
85Assert.Throws<NotSupportedException>(() => stream.SetLength(0)); 123var ioEx = Assert.Throws<InvalidOperationException>(() => stream.Write(new byte[1], 0, 1));
KestrelServerLimitsTests.cs (4)
23Assert.Throws<ArgumentOutOfRangeException>(() => 52Assert.Throws<ArgumentOutOfRangeException>(() => 80Assert.Throws<ArgumentOutOfRangeException>(() => 134Assert.Throws<ArgumentOutOfRangeException>(() =>
KestrelServerTests.cs (5)
55var exception = Assert.Throws<FormatException>(() => StartDummyApplication(server)); 87var ex = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 126var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 232var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server)); 259var exception = Assert.Throws<InvalidOperationException>(() => StartDummyApplication(server));
src\Shared\test\Shared.Tests\runtime\Http2\HPackDecoderTest.cs (15)
176HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 253HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x7e }, endHeaders: true, handler: _handler)); 277HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 301HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 325HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 371HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 403HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x0f, 0x2f }, endHeaders: true, handler: _handler)); 498HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x1f, 0x2f }, endHeaders: true, handler: _handler)); 621HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 636HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 663HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 676HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 727var ex = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler)); 867HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 901HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
src\Shared\test\Shared.Tests\runtime\Http3\QPackDecoderTest.cs (1)
295QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
ThrowingWasUpgradedWriteOnlyStreamTests.cs (2)
22Assert.Equal(CoreStrings.ResponseStreamWasUpgraded, Assert.Throws<InvalidOperationException>(() => stream.Write(new byte[1], 0, 1)).Message); 24Assert.Equal(CoreStrings.ResponseStreamWasUpgraded, Assert.Throws<InvalidOperationException>(() => stream.Flush()).Message);
Microsoft.AspNetCore.Server.Kestrel.Tests (14)
HttpsConfigurationTests.cs (4)
46Assert.Throws<InvalidOperationException>(host.Run); 73Assert.Throws<InvalidOperationException>(host.Run); 106Assert.Throws<InvalidOperationException>(host.Run); 176Assert.Throws<InvalidOperationException>(host.Run);
KestrelConfigurationLoaderTests.cs (10)
599var ex = Assert.Throws<ArgumentException>(() => 624var ex = Assert.Throws<ArgumentException>(() => 649var ex = Assert.Throws<CryptographicException>(() => 673var ex = Assert.Throws<InvalidOperationException>(() => 802var ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 811ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 820ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 829ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 838ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load()); 1792Assert.Throws<InvalidOperationException>(serverOptions.ConfigurationLoader.ProcessEndpointsToAdd);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (2)
QuicStreamContextTests.cs (2)
582Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.AbortRead(errorCode, new ConnectionAbortedException())); 583Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.AbortWrite(errorCode, new ConnectionAbortedException()));
Microsoft.AspNetCore.Shared.Tests (17)
runtime\Http2\HPackDecoderTest.cs (15)
176HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 253HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x7e }, endHeaders: true, handler: _handler)); 277HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 301HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 325HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 371HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 403HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x0f, 0x2f }, endHeaders: true, handler: _handler)); 498HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(new byte[] { 0x1f, 0x2f }, endHeaders: true, handler: _handler)); 621HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 636HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(data, endHeaders: true, handler: _handler)); 663HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => 676HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 727var ex = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler)); 867HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler)); 901HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
runtime\Http3\QPackDecoderTest.cs (1)
295QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
WebEncodersTests.cs (1)
33Assert.Throws<FormatException>(() =>
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Internal\Formatters\BinaryMessageParserTests.cs (1)
68var ex = Assert.Throws<FormatException>(() =>
Internal\Protocol\HandshakeProtocolTests.cs (1)
91var exception = Assert.Throws<InvalidDataException>(() =>
Microsoft.AspNetCore.SignalR.Tests (3)
DefaultHubActivatorTests.cs (1)
61Assert.Throws<ArgumentNullException>(
MapSignalRTests.cs (2)
21var ex = Assert.Throws<NotSupportedException>(() => 50var ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaServicesExtensionsTests.cs (1)
35var exception = Assert.Throws<InvalidOperationException>(
Microsoft.AspNetCore.TestHost.Tests (1)
ResponseFeatureTests.cs (1)
48Assert.Throws<InvalidOperationException>(() =>
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
1818Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddSingleton(new Service())); 1820Assert.Throws<InvalidOperationException>(() => builder.Services.TryAddScoped<IService, Service>());
Microsoft.AspNetCore.WebUtilities.Tests (18)
FileBufferingWriteStreamTests.cs (2)
255var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length)); 270var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length));
FormPipeReaderTests.cs (7)
226var exception = Assert.Throws<InvalidDataException>( 455var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true)); 469var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true)); 483var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true)); 497var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true)); 511var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true)); 525var exception = Assert.Throws<InvalidDataException>(() => formReader.ParseFormValues(ref readOnlySequence, ref accumulator, isFinalBlock: true));
HttpRequestStreamReaderTest.cs (4)
346Assert.Throws<ArgumentNullException>(() => 357Assert.Throws<ArgumentOutOfRangeException>(() => 368Assert.Throws<ArgumentException>(() => 381Assert.Throws<ObjectDisposedException>(() =>
HttpResponseStreamWriterTest.cs (4)
734Assert.Throws<ArgumentNullException>(() => 745Assert.Throws<ArgumentOutOfRangeException>(() => 756Assert.Throws<ArgumentException>(() => 769Assert.Throws<ObjectDisposedException>(() =>
MultipartReaderTests.cs (1)
311Assert.Throws<ArgumentOutOfRangeException>(() =>
Microsoft.Build.CommandLine.UnitTests (1)
CommandLineSwitches_Tests.cs (1)
1148Assert.Throws<InitializationException>(() =>
Microsoft.Build.Engine.OM.UnitTests (236)
Construction\ConstructionEditing_Tests.cs (31)
104Assert.Throws<InvalidOperationException>(() => 118Assert.Throws<InvalidOperationException>(() => 132Assert.Throws<InvalidOperationException>(() => 147Assert.Throws<InvalidOperationException>(() => 163Assert.Throws<InvalidOperationException>(() => 177Assert.Throws<InvalidOperationException>(() => 193Assert.Throws<InvalidOperationException>(() => 209Assert.Throws<InvalidOperationException>(() => 227Assert.Throws<InvalidOperationException>(() => 245Assert.Throws<InvalidOperationException>(() => 259Assert.Throws<InvalidOperationException>(() => 273Assert.Throws<InvalidOperationException>(() => 288Assert.Throws<InvalidOperationException>(() => 303Assert.Throws<InvalidOperationException>(() => 318Assert.Throws<InvalidOperationException>(() => 333Assert.Throws<InvalidOperationException>(() => 349Assert.Throws<InvalidOperationException>(() => 629Assert.Throws<InvalidOperationException>(() => 643Assert.Throws<InvalidOperationException>(() => 659Assert.Throws<InvalidOperationException>(() => 1191Assert.Throws<ArgumentException>(() => 1204Assert.Throws<ArgumentException>(() => 1219Assert.Throws<InvalidOperationException>(() => 1236Assert.Throws<InvalidOperationException>(() => 1254Assert.Throws<InvalidOperationException>(() => 1270Assert.Throws<InvalidOperationException>(() => 1286Assert.Throws<InvalidOperationException>(() => 2256Assert.Throws<InvalidOperationException>(() => 2268Assert.Throws<InvalidOperationException>(() => 2280Assert.Throws<ArgumentException>(() => 2307Assert.Throws<InvalidProjectFileException>(infiniteChooseLoop);
Construction\ProjectChooseElement_Tests.cs (9)
29Assert.Throws<InvalidProjectFileException>(() => 47Assert.Throws<InvalidProjectFileException>(() => 64Assert.Throws<InvalidProjectFileException>(() => 83Assert.Throws<InvalidProjectFileException>(() => 107Assert.Throws<InvalidProjectFileException>(() => 126Assert.Throws<InvalidProjectFileException>(() => 146Assert.Throws<InvalidProjectFileException>(() => 169Assert.Throws<InvalidProjectFileException>(() => 237Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectExtensionsElement_Tests.cs (3)
47Assert.Throws<InvalidProjectFileException>(() => 64Assert.Throws<InvalidProjectFileException>(() => 98Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectImportElement_Tests.cs (4)
40Assert.Throws<InvalidProjectFileException>(() => 57Assert.Throws<InvalidProjectFileException>(() => 74Assert.Throws<InvalidProjectFileException>(() => 136Assert.Throws<ArgumentException>(() =>
Construction\ProjectImportGroupElement_Tests.cs (5)
179Assert.Throws<InvalidProjectFileException>(() => 199Assert.Throws<InvalidProjectFileException>(() => 219Assert.Throws<InvalidProjectFileException>(() => 238Assert.Throws<InvalidProjectFileException>(() => 346Assert.Throws<ArgumentException>(() =>
Construction\ProjectItemDefinitionElement_Tests.cs (1)
194Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectItemDefinitionGroupElement_Tests.cs (1)
36Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectItemElement_Tests.cs (20)
132Assert.Throws<InvalidProjectFileException>(() => 160Assert.Throws<InvalidProjectFileException>(() => 188Assert.Throws<InvalidProjectFileException>(() => 216Assert.Throws<InvalidProjectFileException>(() => 237Assert.Throws<InvalidProjectFileException>( 260Assert.Throws<InvalidProjectFileException>( 301Assert.Throws<InvalidProjectFileException>(() => 445Assert.Throws<InvalidProjectFileException>(() => 470Assert.Throws<InvalidProjectFileException>(() => 495Assert.Throws<InvalidProjectFileException>(() => 527Assert.Throws<InvalidProjectFileException>(() => 555Assert.Throws<InvalidProjectFileException>(() => 583Assert.Throws<InvalidProjectFileException>(() => 741Assert.Throws<InvalidOperationException>(() => 757Assert.Throws<InvalidOperationException>(() => 818Assert.Throws<InvalidOperationException>(() => 834Assert.Throws<InvalidOperationException>(() => 850Assert.Throws<InvalidOperationException>(() => 912Assert.Throws<InvalidOperationException>(() => 928Assert.Throws<InvalidOperationException>(() =>
Construction\ProjectMetadataElement_Tests.cs (14)
49Assert.Throws<InvalidProjectFileException>(() => 70Assert.Throws<InvalidProjectFileException>(() => 103Assert.Throws<InvalidProjectFileException>(() => 115Assert.Throws<InvalidProjectFileException>(() => 148Assert.Throws<InvalidProjectFileException>(() => 160Assert.Throws<InvalidProjectFileException>(() => 196Assert.Throws<InvalidProjectFileException>(() => 247Assert.Throws<ArgumentException>(() => 261Assert.Throws<InvalidProjectFileException>(() => 274Assert.Throws<InvalidProjectFileException>(() => 309Assert.Throws<InvalidProjectFileException>(() => 336Assert.Throws<InvalidProjectFileException>(() => 360Assert.Throws<ArgumentNullException>(() => 373Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectOnErrorElement_Tests.cs (9)
70Assert.Throws<InvalidProjectFileException>(() => 96Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() => 138Assert.Throws<InvalidProjectFileException>(() => 159Assert.Throws<InvalidProjectFileException>(() => 179Assert.Throws<InvalidProjectFileException>(() => 199Assert.Throws<InvalidProjectFileException>(() => 232Assert.Throws<ArgumentNullException>(() => 245Assert.Throws<ArgumentException>(() =>
Construction\ProjectOutputElement_Tests.cs (9)
56Assert.Throws<InvalidProjectFileException>(() => 78Assert.Throws<InvalidProjectFileException>(() => 100Assert.Throws<InvalidProjectFileException>(() => 122Assert.Throws<InvalidProjectFileException>(() => 144Assert.Throws<InvalidProjectFileException>(() => 168Assert.Throws<InvalidProjectFileException>(() => 190Assert.Throws<InvalidProjectFileException>(() => 240Assert.Throws<InvalidOperationException>(() => 267Assert.Throws<InvalidOperationException>(() =>
Construction\ProjectPropertyElement_Tests.cs (7)
62Assert.Throws<InvalidProjectFileException>(() => 81Assert.Throws<InvalidProjectFileException>(() => 100Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() => 138Assert.Throws<InvalidProjectFileException>(() => 216Assert.Throws<ArgumentException>(() => 243Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectRootElement_Tests.cs (16)
268Assert.Throws<InvalidProjectFileException>(() => 280Assert.Throws<InvalidProjectFileException>(() => 293Assert.Throws<InvalidProjectFileException>(() => 308Assert.Throws<InvalidProjectFileException>(() => 325Assert.Throws<InvalidProjectFileException>(() => 340Assert.Throws<InvalidProjectFileException>(() => 392Assert.Throws<InvalidProjectFileException>(() => 412Assert.Throws<InvalidProjectFileException>(() => 553Assert.Throws<InvalidOperationException>(() => 690Assert.Throws<InvalidOperationException>(() => 987Assert.Throws<InvalidProjectFileException>(() => 1636Assert.Throws<InvalidProjectFileException>( 1656Assert.Throws<InvalidOperationException>( 1675Assert.Throws<InvalidOperationException>( 1803Assert.Throws<InvalidProjectFileException>( 1823Assert.Throws<InvalidOperationException>(
Construction\ProjectTargetElement_Tests.cs (8)
30Assert.Throws<ArgumentException>(() => 105Assert.Throws<ArgumentNullException>(() => 117Assert.Throws<ArgumentNullException>(() => 129Assert.Throws<ArgumentNullException>(() => 141Assert.Throws<ArgumentNullException>(() => 165Assert.Throws<InvalidProjectFileException>(() => 182Assert.Throws<InvalidProjectFileException>(() => 357var error = Assert.Throws<InvalidProjectFileException>(() =>
Construction\ProjectTaskElement_Tests.cs (5)
84Assert.Throws<InvalidProjectFileException>(() => 170Assert.Throws<ArgumentNullException>(() => 183Assert.Throws<ArgumentException>(() => 196Assert.Throws<ArgumentException>(() => 209Assert.Throws<ArgumentNullException>(() =>
Construction\ProjectUsingTaskElement_Tests.cs (16)
37Assert.Throws<InvalidProjectFileException>(() => 54Assert.Throws<InvalidProjectFileException>(() => 71Assert.Throws<InvalidProjectFileException>(() => 88Assert.Throws<InvalidProjectFileException>(() => 105Assert.Throws<InvalidProjectFileException>(() => 122Assert.Throws<InvalidProjectFileException>(() => 139Assert.Throws<InvalidProjectFileException>(() => 156Assert.Throws<InvalidProjectFileException>(() => 173Assert.Throws<InvalidProjectFileException>(() => 277Assert.Throws<InvalidOperationException>(() => 290Assert.Throws<InvalidOperationException>(() => 348Assert.Throws<InvalidProjectFileException>(() => 368Assert.Throws<InvalidProjectFileException>(() => 388Assert.Throws<InvalidProjectFileException>(() => 433Assert.Throws<InvalidProjectFileException>(() => 456Assert.Throws<InvalidProjectFileException>(() =>
Construction\SolutionFile_Tests.cs (2)
56Assert.Throws<InvalidProjectFileException>(() => 143Assert.Throws<InvalidProjectFileException>(() =>
Construction\UsingTaskBodyElement_Tests.cs (3)
38Assert.Throws<InvalidProjectFileException>(() => 58Assert.Throws<InvalidProjectFileException>(() => 105Assert.Throws<ArgumentNullException>(() =>
Construction\UsingTaskParameterElement_Tests.cs (1)
80Assert.Throws<InvalidProjectFileException>(() =>
Construction\UsingTaskParameterGroup_Tests.cs (2)
107Assert.Throws<InvalidProjectFileException>(() => 119Assert.Throws<InvalidProjectFileException>(() =>
Definition\DefinitionEditing_Tests.cs (10)
228Assert.Throws<ArgumentException>(() => 1587Assert.Throws<InvalidOperationException>(() => 1602Assert.Throws<InvalidOperationException>(() => 1617Assert.Throws<InvalidOperationException>(() => 1632Assert.Throws<InvalidOperationException>(() => 1647Assert.Throws<InvalidOperationException>(() => 1721Assert.Throws<InvalidOperationException>(() => 1736Assert.Throws<InvalidOperationException>(() => 2152Assert.Throws<ArgumentException>(() => 2601var ex = Assert.Throws<InvalidOperationException>(() => itemOperation(project, item));
Definition\Project_Tests.cs (1)
4274Assert.Throws<InvalidProjectFileException>(() => project.ReevaluateIfNecessary());
Definition\ProjectCollection_Tests.cs (8)
373Assert.Throws<InvalidOperationException>(() => 740Assert.Throws<InvalidOperationException>(() => 755Assert.Throws<InvalidOperationException>(() => 1017Assert.Throws<ArgumentNullException>(() => 1061Assert.Throws<ArgumentNullException>(() => 1073Assert.Throws<ArgumentException>(() => 1121Assert.Throws<ArgumentException>(() => 1133Assert.Throws<InvalidOperationException>(() =>
Definition\ProjectItem_Tests.cs (11)
232Assert.Throws<ArgumentException>(() => 245Assert.Throws<ArgumentException>(() => 258Assert.Throws<InvalidOperationException>(() => 1628Assert.Throws<InvalidProjectFileException>(() => 1911Assert.Throws<InvalidOperationException>(() => 1944Assert.Throws<ArgumentException>(() => 2035Assert.Throws<ArgumentException>(() => 2050Assert.Throws<InvalidOperationException>(() => 2081Assert.Throws<InvalidOperationException>(() => 2112Assert.Throws<InvalidOperationException>(() => 2995var exception = Assert.Throws<InvalidProjectFileException>(() =>
Definition\ProjectItemDefinition_Tests.cs (9)
118Assert.Throws<InvalidOperationException>(() => 472Assert.Throws<InvalidProjectFileException>(() => 494Assert.Throws<InvalidProjectFileException>(() => 516Assert.Throws<InvalidProjectFileException>(() => 538Assert.Throws<InvalidProjectFileException>(() => 560Assert.Throws<InvalidProjectFileException>(() => 582Assert.Throws<InvalidProjectFileException>(() => 604Assert.Throws<InvalidProjectFileException>(() => 626Assert.Throws<InvalidProjectFileException>(() =>
Definition\ProjectMetadata_Tests.cs (1)
458Assert.Throws<InvalidOperationException>(() =>
Definition\ProjectProperty_Tests.cs (2)
134Assert.Throws<InvalidOperationException>(() => 257Assert.Throws<InvalidOperationException>(() =>
Definition\ProtectImports_Tests.cs (12)
131Assert.Throws<InvalidOperationException>(() => 162Assert.Throws<InvalidOperationException>(() => 181Assert.Throws<InvalidOperationException>(() => 196Assert.Throws<InvalidOperationException>(() => 211Assert.Throws<InvalidOperationException>(() => 226Assert.Throws<InvalidOperationException>(() => 301Assert.Throws<InvalidOperationException>(() => 316Assert.Throws<InvalidOperationException>(() => 331Assert.Throws<InvalidOperationException>(() => 346Assert.Throws<InvalidOperationException>(() => 424Assert.Throws<InvalidOperationException>(() => 439Assert.Throws<InvalidOperationException>(() =>
Instance\ProjectInstance_Tests.cs (6)
154Assert.Throws<ArgumentNullException>(() => 166Assert.Throws<ArgumentException>(() => 178Assert.Throws<ArgumentNullException>(() => 343Assert.Throws<ArgumentNullException>(() => 355Assert.Throws<ArgumentNullException>(() => 367Assert.Throws<ArgumentNullException>(() =>
Instance\ProjectItemInstance_Tests.cs (5)
221Assert.Throws<ArgumentException>(() => 233Assert.Throws<ArgumentNullException>(() => 295Assert.Throws<ArgumentNullException>(() => 307Assert.Throws<ArgumentException>(() => 729Assert.Throws<InvalidProjectFileException>(() =>
Instance\ProjectPropertyInstance_Tests.cs (1)
69Assert.Throws<ArgumentNullException>(() =>
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (4)
166Assert.Throws<ArgumentException>(() => 183Assert.Throws<ArgumentException>(() => 203Assert.Throws<ArgumentException>(() => 221Assert.Throws<ArgumentException>(() =>
Microsoft.Build.Engine.UnitTests (233)
AssemblyNameEx_Tests.cs (2)
326Assert.Throws<FileLoadException>(() => 338Assert.Throws<FileLoadException>(() =>
BackEnd\AssemblyTaskFactory_Tests.cs (8)
56Assert.Throws<ArgumentNullException>(() => 68Assert.Throws<InvalidProjectFileException>(() => 80Assert.Throws<InvalidProjectFileException>(() => 92Assert.Throws<InvalidProjectFileException>(() => 106Assert.Throws<InternalErrorException>(() => 120Assert.Throws<InternalErrorException>(() => 152Assert.Throws<InvalidProjectFileException>(() => 163Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\BatchingEngine_Tests.cs (2)
161Assert.Throws<InvalidProjectFileException>(() => 198Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\BinaryTranslator_Tests.cs (2)
810_ = Assert.Throws<InvalidOperationException>(() => 826_ = Assert.Throws<InvalidOperationException>(() =>
BackEnd\BuildEventArgTransportSink_Tests.cs (2)
39Assert.Throws<InternalErrorException>(() => 50Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildManager_Tests.cs (6)
112Assert.Throws<ArgumentNullException>(() => { new BuildParameters(null); }); 1138Assert.Throws<InvalidOperationException>(() => 1177Assert.Throws<InvalidOperationException>(() => _buildManager.BeginBuild(new BuildParameters())); 1208Assert.Throws<InvalidOperationException>(() => _buildManager.EndBuild()); 1249Assert.Throws<InvalidOperationException>(() => { _buildManager.Build(new BuildParameters(), data); }); 1311Assert.Throws<InvalidOperationException>(() => _buildManager.EndBuild());
BackEnd\BuildRequest_Tests.cs (3)
29Assert.Throws<ArgumentNullException>(() => 98Assert.Throws<InternalErrorException>(() => 108Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildRequestConfiguration_Tests.cs (8)
42Assert.Throws<ArgumentNullException>(() => 50Assert.Throws<ArgumentNullException>(() => 64Assert.Throws<InternalErrorException>(() => 88Assert.Throws<ArgumentNullException>(() => 97Assert.Throws<ArgumentNullException>(() => 137Assert.Throws<InternalErrorException>(() => 497var exception = Assert.Throws<InternalErrorException>( 507var exception = Assert.Throws<InternalErrorException>(
BackEnd\BuildRequestEntry_Tests.cs (5)
34Assert.Throws<ArgumentNullException>(() => 178Assert.Throws<InternalErrorException>(() => 194Assert.Throws<InternalErrorException>(() => 211Assert.Throws<InternalErrorException>(() => 235Assert.Throws<InternalErrorException>(() =>
BackEnd\BuildResult_Tests.cs (8)
61Assert.Throws<NullReferenceException>(() => 136Assert.Throws<KeyNotFoundException>(() => 147Assert.Throws<KeyNotFoundException>(() => 159Assert.Throws<ArgumentNullException>(() => 170Assert.Throws<ArgumentNullException>(() => 181Assert.Throws<ArgumentNullException>(() => 216Assert.Throws<ArgumentNullException>(() => 229Assert.Throws<InternalErrorException>(() =>
BackEnd\CentralForwardingLogger_Tests.cs (2)
54Assert.Throws<InternalErrorException>(() => 67Assert.Throws<InternalErrorException>(() =>
BackEnd\ConfigurationMetadata_Tests.cs (2)
36Assert.Throws<ArgumentNullException>(() => 48Assert.Throws<ArgumentNullException>(() =>
BackEnd\EventRedirectorToSink_Tests.cs (3)
23Assert.Throws<InternalErrorException>(() => 36Assert.Throws<InternalErrorException>(() => 81Assert.Throws<InternalErrorException>(() =>
BackEnd\EventSourceSink_Tests.cs (1)
125Assert.Throws<InternalErrorException>(() =>
BackEnd\FullyQualifiedBuildRequest_Tests.cs (2)
31Assert.Throws<ArgumentNullException>(() => 40Assert.Throws<ArgumentNullException>(() =>
BackEnd\IntrinsicTask_Tests.cs (10)
86Assert.Throws<InvalidProjectFileException>(() => 104Assert.Throws<InvalidProjectFileException>(() => 142Assert.Throws<InvalidProjectFileException>(() => 159Assert.Throws<InvalidProjectFileException>(() => 663Assert.Throws<InvalidProjectFileException>(() => 757Assert.Throws<InvalidProjectFileException>(() => 773Assert.Throws<InvalidProjectFileException>(() => 791Assert.Throws<InvalidProjectFileException>(() => 1603Assert.Throws<InvalidProjectFileException>(() => 3005Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\LoggingContext_Tests.cs (1)
59Assert.Throws<InternalErrorException>(() =>
BackEnd\LoggingService_Tests.cs (15)
116Assert.Throws<InternalErrorException>(() => 128Assert.Throws<InternalErrorException>(() => 188Assert.Throws<InternalErrorException>(() => 203Assert.Throws<InternalErrorException>(() => 215Assert.Throws<InternalErrorException>(() => 229Assert.Throws<LoggerException>(() => 242Assert.Throws<InternalLoggerException>(() => 255Assert.Throws<StackOverflowException>(() => 318Assert.Throws<InternalErrorException>(() => 330Assert.Throws<InternalErrorException>(() => 501Assert.Throws<InternalErrorException>(() => 512Assert.Throws<InternalErrorException>(() => 523Assert.Throws<InternalErrorException>(() => 672Assert.Throws<InternalErrorException>(() => 685Assert.Throws<InternalErrorException>(() =>
BackEnd\LoggingServicesLogMethod_Tests.cs (33)
52Assert.Throws<InternalErrorException>(() => 102Assert.Throws<InternalErrorException>(() => 115Assert.Throws<InternalErrorException>(() => 152Assert.Throws<InternalErrorException>(() => 165Assert.Throws<InternalErrorException>(() => 213Assert.Throws<InternalErrorException>(() => 226Assert.Throws<InternalErrorException>(() => 257Assert.Throws<InternalErrorException>(() => 271Assert.Throws<InternalErrorException>(() => 331Assert.Throws<InternalErrorException>(() => 372Assert.Throws<InternalErrorException>(() => 385Assert.Throws<InternalErrorException>(() => 398Assert.Throws<InternalErrorException>(() => 508Assert.Throws<InternalErrorException>(() => 522Assert.Throws<InternalErrorException>(() => 566Assert.Throws<InternalErrorException>(() => 579Assert.Throws<InternalErrorException>(() => 606Assert.Throws<InternalErrorException>(() => 619Assert.Throws<InternalErrorException>(() => 632Assert.Throws<InternalErrorException>(() => 676Assert.Throws<InternalErrorException>(() => 689Assert.Throws<InternalErrorException>(() => 729Assert.Throws<InternalErrorException>(() => 752Assert.Throws<InternalErrorException>(() => 792Assert.Throws<InternalErrorException>(() => 806Assert.Throws<InternalErrorException>(() => 910Assert.Throws<InternalErrorException>(() => 975Assert.Throws<InternalErrorException>(() => 1093Assert.Throws<InternalErrorException>(() => 1128Assert.Throws<InternalErrorException>(() => 1168Assert.Throws<InternalErrorException>(() => 1216Assert.Throws<InternalErrorException>(() => 1255InternalErrorException exception = Assert.Throws<InternalErrorException>(() =>
BackEnd\Lookup_Tests.cs (1)
1011Assert.Throws<InternalErrorException>(() =>
BackEnd\NodeEndpointInProc_Tests.cs (2)
190Assert.Throws<ArgumentNullException>(() => 200Assert.Throws<ArgumentNullException>(() =>
BackEnd\NodePackets_Tests.cs (1)
36Assert.Throws<InternalErrorException>(() =>
BackEnd\OnError_Tests.cs (1)
556Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\ResultsCache_Tests.cs (1)
138Assert.Throws<InternalErrorException>(() =>
BackEnd\TargetEntry_Tests.cs (5)
79Assert.Throws<ArgumentNullException>(() => 94Assert.Throws<ArgumentNullException>(() => 108Assert.Throws<ArgumentNullException>(() => 135Assert.Throws<InternalErrorException>(() => 149Assert.Throws<InternalErrorException>(() =>
BackEnd\TargetResult_Tests.cs (1)
53Assert.Throws<ArgumentNullException>(() =>
BackEnd\TaskExecutionHost_Tests.cs (7)
156Assert.Throws<InvalidProjectFileException>(() => 489Assert.Throws<InvalidProjectFileException>(() => 639Assert.Throws<IndexOutOfRangeException>(() => 929Assert.Throws<InvalidProjectFileException>(() => 940Assert.Throws<InvalidProjectFileException>(() => 951Assert.Throws<InvalidProjectFileException>(() => 978Assert.Throws<InvalidProjectFileException>(() =>
BackEnd\TaskHost_Tests.cs (8)
236Assert.Throws<ArgumentNullException>(() => 247Assert.Throws<ArgumentNullException>(() => 258Assert.Throws<ArgumentNullException>(() => 269Assert.Throws<ArgumentNullException>(() => 765Assert.Throws<ArgumentOutOfRangeException>(() => 770Assert.Throws<ArgumentOutOfRangeException>(() => 805Assert.Throws<ArgumentOutOfRangeException>(() => 810Assert.Throws<ArgumentOutOfRangeException>(() =>
BackEnd\TaskHostConfiguration_Tests.cs (3)
38Assert.Throws<InternalErrorException>(() => 74Assert.Throws<InternalErrorException>(() => 110Assert.Throws<InternalErrorException>(() =>
BackEnd\TaskRegistry_Tests.cs (8)
1375Assert.Throws<InvalidProjectFileException>(() => 1417Assert.Throws<InvalidProjectFileException>(() => 1459Assert.Throws<InvalidProjectFileException>(() => 1481Assert.Throws<InvalidProjectFileException>(() => 1552Assert.Throws<InvalidProjectFileException>(() => 1600Assert.Throws<InvalidProjectFileException>(() => 1647Assert.Throws<InvalidProjectFileException>(() => 1807Assert.Throws<InvalidProjectFileException>(() =>
Collections\MSBuildNameIgnoreCaseComparer_Tests.cs (3)
82Assert.Throws<InternalErrorException>(() => 93Assert.Throws<InternalErrorException>(() => 104Assert.Throws<InternalErrorException>(() =>
Collections\OMcollections_tests.cs (1)
240Assert.Throws<InternalErrorException>(() =>
Construction\ElementLocation_Tests.cs (6)
212Assert.Throws<InternalErrorException>(() => 223Assert.Throws<InternalErrorException>(() => 350Assert.Throws<InvalidOperationException>(() => 370Assert.Throws<InvalidOperationException>(() => 387Assert.Throws<InvalidOperationException>(() => 406Assert.Throws<InvalidOperationException>(() =>
Construction\SolutionProjectGenerator_Tests.cs (2)
789Assert.Throws<InvalidProjectFileException>(() => 2381Assert.Throws<InvalidProjectFileException>(() =>
CopyOnWriteDictionary_Tests.cs (1)
44Assert.Throws<KeyNotFoundException>(() =>
Definition\ItemDefinitionGroup_Tests.cs (7)
163Assert.Throws<InvalidProjectFileException>(() => 192Assert.Throws<InvalidProjectFileException>(() => 220Assert.Throws<InvalidProjectFileException>(() => 812Assert.Throws<InvalidProjectFileException>(() => 831Assert.Throws<InvalidProjectFileException>(() => 847Assert.Throws<InvalidProjectFileException>(() => 1059Assert.Throws<InvalidProjectFileException>(() =>
Definition\Toolset_Tests.cs (3)
24Assert.Throws<ArgumentNullException>(() => 33Assert.Throws<ArgumentNullException>(() => 42Assert.Throws<ArgumentException>(() =>
Definition\ToolsetConfigurationReader_Tests.cs (9)
201Assert.Throws<ConfigurationErrorsException>(() => 229Assert.Throws<ConfigurationErrorsException>(() => 257Assert.Throws<ConfigurationErrorsException>(() => 324Assert.Throws<ConfigurationErrorsException>(() => 349Assert.Throws<ConfigurationErrorsException>(() => 374Assert.Throws<ConfigurationErrorsException>(() => 400Assert.Throws<ConfigurationErrorsException>(() => 600Assert.Throws<ConfigurationErrorsException>(() => 635Assert.Throws<ConfigurationErrorsException>(() =>
Definition\ToolsVersion_Tests.cs (1)
402Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\Evaluator_Tests.cs (4)
990InvalidProjectFileException ex = Assert.Throws<InvalidProjectFileException>(() => 1065Assert.Throws<InvalidProjectFileException>(() => 3158Assert.Throws<InvalidProjectFileException>(() => 4570InvalidProjectFileException ex = Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\Expander_Tests.cs (15)
1758Assert.Throws<InvalidProjectFileException>(() => 1775Assert.Throws<InvalidProjectFileException>(() => 2349Assert.Throws<InvalidProjectFileException>(() => 2367Assert.Throws<InvalidProjectFileException>(() => 2384Assert.Throws<InvalidProjectFileException>(() => 2401Assert.Throws<InvalidProjectFileException>(() => 2419Assert.Throws<InvalidProjectFileException>(() => 2435Assert.Throws<InvalidProjectFileException>(() => 2451Assert.Throws<InvalidProjectFileException>(() => 2467Assert.Throws<InvalidProjectFileException>(() => 3451InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 3467InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 3629Assert.Throws<InvalidProjectFileException>(() => 4526Assert.Throws<InvalidProjectFileException>(() => 4602Assert.Throws<InvalidProjectFileException>(() =>
Evaluation\ProjectRootElementCache_Tests.cs (2)
49Assert.Throws<InternalErrorException>(() => 60Assert.Throws<InternalErrorException>(() =>
Evaluation\ProjectSdkImplicitImport_Tests.cs (2)
296InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() => 412InvalidProjectFileException exception = Assert.Throws<InvalidProjectFileException>(() =>
FileLogger_Tests.cs (4)
84Assert.Throws<LoggerException>(() => 172Assert.Throws<LoggerException>(() => 186Assert.Throws<LoggerException>(() => 531Assert.Throws<LoggerException>(() =>
FileUtilities_Tests.cs (12)
155Assert.Throws<InvalidOperationException>(() => 166Assert.Throws<InvalidOperationException>(() => 293Assert.Throws<ArgumentException>(() => 424Assert.Throws<PathTooLongException>(() => 449Assert.Throws<ArgumentNullException>(() => 458Assert.Throws<ArgumentException>(() => 467Assert.Throws<ArgumentException>(() => 476Assert.Throws<ArgumentException>(() => 485Assert.Throws<ArgumentException>(() => 509Assert.Throws<ArgumentException>(() => 840Assert.Throws<IOException>(() => 854Assert.Throws<IOException>(() =>
Instance\HostServices_Tests.cs (6)
59Assert.Throws<ArgumentNullException>(() => 72Assert.Throws<ArgumentNullException>(() => 85Assert.Throws<ArgumentNullException>(() => 216Assert.Throws<InvalidOperationException>(() => 231Assert.Throws<InvalidOperationException>(() => 273Assert.Throws<InvalidOperationException>(() =>
Utilities_Tests.cs (2)
147Assert.Throws<InvalidProjectFileException>(() => 164Assert.Throws<InvalidProjectFileException>(() =>
Microsoft.Build.Tasks.UnitTests (16)
AssemblyNameEx_Tests.cs (2)
326Assert.Throws<FileLoadException>(() => 338Assert.Throws<FileLoadException>(() =>
CommandLineBuilderExtension_Tests.cs (1)
28Assert.Throws<ArgumentException>(() =>
FileStateTests.cs (3)
22Assert.Throws<ArgumentException>(() => 43Assert.Throws<ArgumentException>(() => { var time = state.LastWriteTime; }); 392Assert.Throws<FileNotFoundException>(() =>
GetInstalledSDKLocations_Tests.cs (2)
169Assert.Throws<ArgumentNullException>(() => 183Assert.Throws<ArgumentNullException>(() =>
ResolveSDKReference_Tests.cs (2)
1434Assert.Throws<ArgumentNullException>(() => 1450Assert.Throws<ArgumentNullException>(() =>
StreamMappedString_Tests.cs (4)
135Assert.Throws<ArgumentOutOfRangeException>(() => 221Assert.Throws<ArgumentOutOfRangeException>(() => 234Assert.Throws<ArgumentOutOfRangeException>(() => 246Assert.Throws<ArgumentOutOfRangeException>(() =>
ToolTaskExtension_Tests.cs (1)
58Assert.Throws<ArgumentException>(() =>
XslTransformation_Tests.cs (1)
606Assert.Throws<System.ArgumentNullException>(() =>
Microsoft.Build.UnitTests.Shared (1)
ObjectModelHelpers.cs (1)
1917Assert.Throws<InvalidOperationException>(method);
Microsoft.Build.Utilities.UnitTests (1)
MuxLogger_Tests.cs (1)
67Assert.Throws<InvalidOperationException>(() =>
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
Workspaces\WorkspaceTests_EditorFeatures.cs (5)
135Assert.Throws<ArgumentException>(() => workspace.OnProjectRemoved(project.Id)); 149Assert.Throws<ArgumentException>(() => workspace.OnProjectRemoved(project2.Id)); 266Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project1.Id, new ProjectReference(project2.Id))); 305Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project1.Id, new ProjectReference(project2.Id))); 344Assert.Throws<ArgumentException>(() => workspace.OnProjectReferenceAdded(project2.Id, new ProjectReference(project1.Id)));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\ExtensionTests.cs (1)
71Assert.Throws<NotSupportedException>(() => { symbol.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.Annotated); });
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (15)
Semantics\AccessCheckTests.cs (6)
767Assert.Throws<ArgumentNullException>(() => { compilation.IsSymbolAccessibleWithin(classA, nullSymbol); }); 768Assert.Throws<ArgumentNullException>(() => { compilation.IsSymbolAccessibleWithin(nullSymbol, classA); }); 769Assert.Throws<ArgumentException>(() => { compilation.IsSymbolAccessibleWithin(classA, pubField); }); 861Assert.Throws<ArgumentException>(() => { compilation.IsSymbolAccessibleWithin(classA, classOther); }); 945Assert.Throws<ArgumentException>(() => { compilation3.IsSymbolAccessibleWithin(Outer, InOtherCompilation); }); 946Assert.Throws<ArgumentException>(() => { compilation3.IsSymbolAccessibleWithin(Outer, InFriendCompilation); });
Semantics\SyntaxTreeRootTests.cs (5)
108Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.GetCompilationUnitRoot(); }); 109Assert.Throws<ArgumentNullException>(() => { tree.GetDiagnostics((CSharpSyntaxNode)null); }); 110Assert.Throws<InvalidOperationException>(() => { tree.GetDiagnostics(default(SyntaxToken)); }); 111Assert.Throws<ArgumentNullException>(() => { tree.GetDiagnostics((SyntaxNode)null); }); 112Assert.Throws<InvalidOperationException>(() => { tree.GetDiagnostics(default(SyntaxTrivia)); });
SourceGeneration\SyntaxAwareGeneratorTests.cs (4)
188Assert.Throws<InvalidOperationException>(() => 196Assert.Throws<InvalidOperationException>(() => 204Assert.Throws<InvalidOperationException>(() => 212Assert.Throws<InvalidOperationException>(() =>
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (29)
Compilation\CompilationAPITests.cs (19)
1323Assert.Throws<NullReferenceException>( 1384Assert.Throws<ArgumentNullException>( 1453Assert.Throws<ArgumentException>( 1460Assert.Throws<ArgumentNullException>( 1474Assert.Throws<ArgumentException>( 1482Assert.Throws<ArgumentException>( 1509Assert.Throws<ArgumentOutOfRangeException>( 1515Assert.Throws<ArgumentOutOfRangeException>( 1521Assert.Throws<ArgumentOutOfRangeException>( 1527Assert.Throws<ArgumentOutOfRangeException>( 1541Assert.Throws<ArgumentException>( 1565Assert.Throws<ArgumentNullException>( 1572Assert.Throws<ArgumentNullException>( 1584Assert.Throws<ArgumentNullException>( 1601Exception invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1606invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1611invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1619Assert.Throws<ArgumentException>( 2385Assert.Throws<ArgumentException>(() =>
Compilation\ReferenceManagerTests.cs (1)
1327Assert.Throws<TestException>(() => { var a = c.Assembly; });
Compilation\SemanticModelAPITests.cs (1)
647Assert.Throws<ArgumentException>(() =>
Compilation\SymbolSearchTests.cs (8)
20Assert.Throws<ArgumentException>(() => 26Assert.Throws<ArgumentException>(() => 32Assert.Throws<ArgumentException>(() => 38Assert.Throws<ArgumentException>(() => 48Assert.Throws<ArgumentNullException>(() => 54Assert.Throws<ArgumentNullException>(() => 64Assert.Throws<ArgumentNullException>(() => 70Assert.Throws<ArgumentNullException>(() =>
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (5)
LexicalAndXml\SyntaxTokenParserTests.cs (1)
206Assert.Throws<ArgumentOutOfRangeException>(() => parser.SkipForwardTo(0));
Syntax\StructuredTriviaTests.cs (3)
197Assert.Throws<System.ArgumentOutOfRangeException>(delegate 202Assert.Throws<System.ArgumentOutOfRangeException>(delegate 208Assert.Throws<System.ArgumentOutOfRangeException>(delegate
Syntax\SyntaxNodeTests.cs (1)
3624Assert.Throws<System.ArgumentNullException>(delegate
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (6)
MetadataShadowCopyProviderTests.cs (6)
62Assert.Throws<ArgumentNullException>(() => _provider.SuppressShadowCopy(null)); 63Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("c:goo.dll")); 64Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("bar.dll")); 65Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"\bar.dll")); 66Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"../bar.dll")); 160Assert.Throws<IOException>(() => File.Delete(sc));
Microsoft.CodeAnalysis.UnitTests (96)
AnalyzerAssemblyLoaderTests.cs (1)
1470Assert.Throws<UnauthorizedAccessException>(() => File.Delete(testFixture.Delta1));
Collections\HashSet\ISet_Generic_Tests`1.cs (8)
323Assert.Throws<ArgumentNullException>(() => set.ExceptWith(null!)); 324Assert.Throws<ArgumentNullException>(() => set.IntersectWith(null!)); 325Assert.Throws<ArgumentNullException>(() => set.SymmetricExceptWith(null!)); 326Assert.Throws<ArgumentNullException>(() => set.UnionWith(null!)); 331Assert.Throws<NotSupportedException>(() => set.ExceptWith(null!)); 332Assert.Throws<NotSupportedException>(() => set.IntersectWith(null!)); 333Assert.Throws<NotSupportedException>(() => set.SymmetricExceptWith(null!)); 334Assert.Throws<NotSupportedException>(() => set.UnionWith(null!));
Collections\IdentifierCollectionTests.cs (2)
81Assert.Throws<NotSupportedException>(() => collection.Add("x")); 83Assert.Throws<NotSupportedException>(() => collection.Clear());
Collections\ImmutableDictionaryTestBase.cs (6)
131Assert.Throws<NotSupportedException>(() => dictionary.Add(new KeyValuePair<string, int>())); 133Assert.Throws<NotSupportedException>(() => dictionary.Clear()); 157Assert.Throws<NotSupportedException>(() => dictionary.Add("a", 1)); 168Assert.Throws<NotSupportedException>(() => dictionary.Add("a", 1)); 169Assert.Throws<NotSupportedException>(() => dictionary.Remove("a")); 171Assert.Throws<NotSupportedException>(() => dictionary.Clear());
Collections\ImmutableDictionaryTestBase.nonnetstandard.cs (3)
57Assert.Throws<NotSupportedException>(() => map.Add(5, 3)); 290Assert.Throws<NotSupportedException>(() => collection.Add(default(T)!)); 291Assert.Throws<NotSupportedException>(() => collection.Clear());
Collections\ImmutableSegmentedListTest.cs (8)
749Assert.Throws<NotSupportedException>(() => list.Clear()); 750Assert.Throws<NotSupportedException>(() => list.Insert(0, 1)); 751Assert.Throws<NotSupportedException>(() => list.Remove(1)); 752Assert.Throws<NotSupportedException>(() => list.RemoveAt(0)); 761Assert.Throws<NotSupportedException>(() => list.Add(1)); 762Assert.Throws<NotSupportedException>(() => list.Clear()); 763Assert.Throws<NotSupportedException>(() => list.Insert(0, 1)); 765Assert.Throws<NotSupportedException>(() => list.RemoveAt(0));
Collections\ImmutableSetTest.cs (6)
173Assert.Throws<NotSupportedException>(() => set.ExceptWith(null!)); 174Assert.Throws<NotSupportedException>(() => set.UnionWith(null!)); 175Assert.Throws<NotSupportedException>(() => set.IntersectWith(null!)); 176Assert.Throws<NotSupportedException>(() => set.SymmetricExceptWith(null!)); 183Assert.Throws<NotSupportedException>(() => set.Add(1)); 184Assert.Throws<NotSupportedException>(() => set.Clear());
Collections\List\ICollection.Generic.Tests.cs (8)
284Assert.Throws<NotSupportedException>(() => collection.Add(CreateT(0))); 317Assert.Throws<NotSupportedException>(() => collection.Clear()); 334Assert.Throws<NotSupportedException>(() => collection.Clear()); 335Assert.Throws<NotSupportedException>(() => collection.Clear()); 336Assert.Throws<NotSupportedException>(() => collection.Clear()); 483Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null!, 0)); 492Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, -1)); 493Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, int.MinValue));
Collections\List\ICollection.NonGeneric.Tests.cs (5)
182Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null!, 0)); 252Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, -1)); 253Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(array, int.MinValue)); 263Assert.Throws<ArgumentException>(() => collection.CopyTo(array, count)); 286Assert.Throws<ArgumentException>(() => collection.CopyTo(array, 1));
Collections\List\IEnumerable.Generic.Tests.cs (7)
697Assert.Throws<NotSupportedException>(() => enumerator.Reset()); 714Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 757Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 801Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 839Assert.Throws<NotSupportedException>( 856Assert.Throws<NotSupportedException>( 872Assert.Throws<NotSupportedException>(
Collections\List\IEnumerable.NonGeneric.Tests.cs (4)
366Assert.Throws<NotSupportedException>(() => enumerator.Reset()); 381Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 407Assert.Throws<InvalidOperationException>(() => enumerator.Reset()); 430Assert.Throws<InvalidOperationException>(() => enumerator.Reset());
Collections\List\IList.Generic.Tests.cs (10)
406Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, validAdd)); 407Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(int.MinValue, validAdd)); 433Assert.Throws<NotSupportedException>(() => list.Insert(count / 2, CreateT(321432))); 506Assert.Throws<NotSupportedException>(() => list.Insert(0, value)); 528Assert.Throws<ArgumentException>(() => list.Insert(count / 2, value)); 545Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(-1)); 546Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(int.MinValue)); 559Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(count)); 560Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(count + 1)); 572Assert.Throws<NotSupportedException>(() => list.RemoveAt(count / 2));
Collections\List\IList.NonGeneric.Tests.cs (7)
544Assert.Throws<NotSupportedException>(() => collection.Clear()); 766Assert.Throws<NotSupportedException>(() => list.Insert(count / 2, CreateT(321432))); 854Assert.Throws<ArgumentException>(() => list.Insert(count / 2, value)); 870Assert.Throws<NotSupportedException>(() => collection.Remove(CreateT(34543))); 908Assert.Throws<ArgumentException>(() => list.Remove(value)); 999Assert.Throws<ArgumentException>(() => collection.Remove(value)); 1044Assert.Throws<NotSupportedException>(() => list.RemoveAt(count / 2));
Collections\List\SegmentedList.Generic.Tests.Misc.cs (1)
115Assert.Throws<ArgumentOutOfRangeException>(() => _ilist.Insert(bad[i], items[0])); //"ArgumentOutOfRangeException expected."
Collections\TestExtensionsMethods.cs (1)
20Assert.Throws<NullReferenceException>(a);
FileLinePositionSpanTests.cs (3)
35Assert.Throws<ArgumentNullException>( 41Assert.Throws<ArgumentException>( 47Assert.Throws<ArgumentException>(
LinePositionTests.cs (2)
31Assert.Throws<ArgumentOutOfRangeException>( 38Assert.Throws<ArgumentOutOfRangeException>(
MetadataReferences\AssemblyIdentityTests.cs (1)
81Assert.Throws<ArgumentNullException>(() => { AssemblyIdentity.FromAssemblyDefinition(asm); });
MetadataReferences\ModuleMetadataTests.cs (4)
24Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, 0); }); 25Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, -1); }); 90Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, 0); }); 91Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, -1); });
Text\StringTextTest.cs (1)
84Assert.Throws<IndexOutOfRangeException>(
Text\StringTextTests_Default.cs (1)
50Assert.Throws<IndexOutOfRangeException>(
Text\TextChangeRangeTest.cs (1)
19Assert.Throws<ArgumentOutOfRangeException>(
Text\TextChangeTests.cs (6)
243Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(-1, destination, 0, 2)); 244Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, -1, 2)); 245Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, 0, -1)); 246Assert.Throws<ArgumentNullException>(() => newText.CopyTo(0, null, 0, 2)); 247Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(newText.Length - 1, destination, 0, 2)); 248Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(0, destination, destination.Length - 1, 2));
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (7)
ObjectFormatterTests.vb (2)
88Assert.Throws(Of ArgumentException)(Sub() primitiveFormatter.TestEscapeStringWithoutQuotes()) 89Assert.Throws(Of ArgumentException)(Sub() primitiveFormatter.TestEscapeCharWithoutQuotes())
PrintOptionsTests.vb (5)
18Assert.Throws(Of ArgumentNullException)(Sub() s_formatter.FormatObject("hello", options:=Nothing)) 23Assert.Throws(Of ArgumentOutOfRangeException)( 32Assert.Throws(Of ArgumentOutOfRangeException)( 41Assert.Throws(Of ArgumentOutOfRangeException)( 46Assert.Throws(Of ArgumentOutOfRangeException)(
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
2187Assert.Throws<NotSupportedException>(delegate 2197Assert.Throws<NotSupportedException>(delegate
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
CommandLineProject\CommandLineProjectTests.cs (1)
37Assert.Throws<InvalidOperationException>(delegate
ObjectSerializationTests.cs (4)
243Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(uint.MaxValue)); // max uint not allowed 244Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0x80000000u)); // highest bit set not allowed 245Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0x40000000u)); // second highest bit set not allowed 246Assert.Throws<ArgumentException>(() => TestRoundTripCompressedUint(0xC0000000u)); // both high bits set not allowed
UtilityTest\AsyncLazyTests.cs (1)
248var thrownException = Assert.Throws<OperationCanceledException>(() =>
Microsoft.Data.Analysis.Tests (9)
DataFrame.IOTests.cs (1)
1079Assert.Throws<ArgumentException>(() => DataFrame.SaveCsv(dataFrame, csvStream, separator: separator, cultureInfo: cultureInfo));
DataFrameTests.cs (7)
78Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, bigColumn)); 79Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(bigColumn)); 83Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, smallColumn)); 84Assert.Throws<ArgumentException>(() => dataFrame.Columns.Add(smallColumn)); 88Assert.Throws<ArgumentException>(() => dataFrame.Columns.Insert(2, repeatedName)); 93Assert.Throws<ArgumentOutOfRangeException>(() => dataFrame.Columns.Insert(columnCount + 1, repeatedName)); 806Assert.Throws<ArgumentException>(() => df.Columns.Insert(1, new Int32DataFrameColumn("Int2", Enumerable.Range(0, 5).Select(x => x))));
TextFieldParserTests.cs (1)
113Assert.Throws<ArgumentException>(() => parser.SetFieldWidths(new[] { -1, -1 }));
Microsoft.DotNet.Build.Tasks.Workloads.Tests (2)
PackageTests.cs (1)
50Assert.Throws<ArgumentOutOfRangeException>(() => { WorkloadSetPackage p = new(workloadSetPackageItem, PackageRootDirectory, new Version("256.12.3")); });
SwixPackageTests.cs (1)
28Exception e = Assert.Throws<Exception>(() =>
Microsoft.DotNet.NuGetRepack.Tests (4)
VersionUpdaterTests.cs (4)
138var e1 = Assert.Throws<InvalidOperationException>(() => NuGetVersionUpdater.Run(new[] { c_daily }, outDirectoryOpt: null, VersionTranslation.Release, exactVersions: false)); 141var e2 = Assert.Throws<AggregateException>(() => NuGetVersionUpdater.Run(new[] { a_daily }, outDirectoryOpt: null, VersionTranslation.Release, exactVersions: false)); 149var e3 = Assert.Throws<AggregateException>(() => NuGetVersionUpdater.Run(new[] { a_daily, b_daily }, outDirectoryOpt: null, VersionTranslation.Release, exactVersions: false)); 156var e4 = Assert.Throws<AggregateException>(() => NuGetVersionUpdater.Run(new[] { a_daily, c_daily }, outDirectoryOpt: null, VersionTranslation.Release, exactVersions: false));
Microsoft.DotNet.RemoteExecutor.Tests (3)
RemoteExecutorTests.cs (3)
26Assert.Throws<RemoteExecutionException>(() => 51Assert.Throws<RemoteExecutionException>(() => 64Assert.Throws<RemoteExecutionException>(() =>
Microsoft.DotNet.XUnitAssert.Tests (8)
ExceptionAssertsTests.cs (6)
175 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!)); 183 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 199 Assert.Throws<ArgumentException>(testCode); 208 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 226 var ex = Record.Exception(() => Assert.Throws<ArgumentException>(testCode)); 327 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!));
IdentityAssertsTests.cs (1)
55 Assert.Throws<SameException>(() => Assert.Same(0, 0));
SetAssertsTests.cs (1)
334 var ex = Assert.Throws<SupersetException>(() => Assert.Superset(expectedSuperset, actual));
Microsoft.Extensions.AI.Abstractions.Tests (3)
Utilities\AIJsonUtilitiesTests.cs (3)
953Assert.Throws<InvalidOperationException>(() => AIJsonUtilities.DefaultOptions.AddAIContentType<DerivedAIContent>("derivativeContent")); 969Assert.Throws<ArgumentException>(() => options.AddAIContentType<AIContent>("discriminator")); 970Assert.Throws<ArgumentException>(() => options.AddAIContentType<TextContent>("discriminator"));
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (1)
RedisCacheSetAndRemoveTests.cs (1)
99Assert.Throws<ArgumentNullException>(() => cache.Set(key, value));
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
KubernetesProbesOptionsValidatorTests.cs (1)
115Assert.Throws<OptionsValidationException>(action);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Windows\WindowsCountersTests.cs (1)
99Assert.Throws<AggregateException>(() =>
Microsoft.Extensions.Diagnostics.Testing.Tests (3)
Metrics\MetricCollectorTests.cs (3)
362Assert.Throws<ObjectDisposedException>(() => collector.Clear()); 364Assert.Throws<ObjectDisposedException>(() => collector.RecordObservableInstruments()); 379Assert.Throws<ObjectDisposedException>(() => collector.Clear());
Microsoft.Extensions.Http.Resilience.Tests (10)
Polly\HttpRetryStrategyOptionsExtensionsTests.cs (4)
18Assert.Throws<ArgumentNullException>(() => ((HttpRetryStrategyOptions)null!).DisableFor(HttpMethod.Get)); 24Assert.Throws<ArgumentNullException>(() => new HttpRetryStrategyOptions().DisableFor(null!)); 30Assert.Throws<ArgumentException>(() => new HttpRetryStrategyOptions().DisableFor([])); 37Assert.Throws<ArgumentException>(() => options.DisableFor(HttpMethod.Get));
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (4)
107Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, _validConfigurationSection, options => { })); 117Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, _validConfigurationSection, null!)); 128Assert.Throws<ArgumentNullException>(() => AddStandardResilienceHandler(mode, builder, null!, options => { })); 138Assert.Throws<ArgumentException>(() => AddStandardResilienceHandler(mode, builder, _emptyConfigurationSection, options => { }));
Resilience\HttpResilienceContextExtensionsTests.cs (1)
54Assert.Throws<ArgumentNullException>(() => context.SetRequestMessage(request));
Routing\RoutingStrategyTest.cs (1)
128Assert.Throws<AggregateException>(() => provider.Reload([]));
Microsoft.Extensions.Localization.Tests (1)
ResourceManagerStringLocalizerTest.cs (1)
194var exception = Assert.Throws<MissingManifestResourceException>(() =>
Microsoft.Extensions.SecretManager.Tools.Tests (1)
InitCommandTest.cs (1)
138Assert.Throws<ArgumentException>(() =>
Microsoft.Extensions.Telemetry.Tests (2)
Logging\ExtendedLoggerFactoryTests.cs (2)
25Assert.Throws<ObjectDisposedException>(() => factory.AddProvider(CreateProvider())); 33Assert.Throws<ArgumentNullException>(() => factory.AddProvider(null!));
Microsoft.Extensions.TimeProvider.Testing.Tests (2)
FakeTimeProviderTests.cs (2)
212Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.Advance(TimeSpan.FromTicks(-1))); 220Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.SetUtcNow(timeProvider.GetUtcNow() - TimeSpan.FromTicks(1)));
Microsoft.JSInterop.Tests (5)
Infrastructure\DotNetDispatcherTest.cs (4)
43var ex = Assert.Throws<ArgumentException>(() => 65var ex = Assert.Throws<ArgumentException>(() => 588var ex = Assert.Throws<ArgumentException>(() => 611var ex = Assert.Throws<JsonException>(() =>
JSRuntimeTest.cs (1)
392var ex = Assert.Throws<ArgumentOutOfRangeException>(() => runtime.ReceiveByteArray(7, byteArray));
Microsoft.ML.AutoML.Tests (1)
ColumnInferenceTests.cs (1)
48Assert.Throws<ArgumentException>(new System.Action(() => context.Auto().InferColumns(dataPath, "Junk", groupColumns: false)));
Microsoft.ML.Tests (9)
CachingTests.cs (1)
67var ex = Assert.Throws<InvalidOperationException>(() => CacheOnEmptyEstimatorChain());
DatabaseLoaderTests.cs (1)
46var ex = Assert.Throws<System.Reflection.TargetInvocationException>(() => IrisLightGbmImpl(dbs));
ImagesTests.cs (1)
1302Assert.Throws<ArgumentException>(() => image1.Save(imageTempPath));
Scenarios\Api\TestApi.cs (1)
263Assert.Throws<InvalidOperationException>(() => idv.Schema[1].Annotations.GetValue(kindFloat, ref retrievedReadOnlyMemoryVBuffer));
SvmLightTests.cs (5)
236var ex = Assert.Throws<InvalidOperationException>(() => 507var ex = Assert.Throws<InvalidOperationException>(() => 515ex = Assert.Throws<InvalidOperationException>(() => 523ex = Assert.Throws<InvalidOperationException>(() => 531ex = Assert.Throws<InvalidOperationException>(() =>
Microsoft.Net.Http.Headers.Tests (17)
CacheControlHeaderValueTest.cs (5)
46Assert.Throws<ArgumentException>(() => cacheControl.NoCacheHeaders.Add(null)); 47Assert.Throws<FormatException>(() => cacheControl.NoCacheHeaders.Add("invalid PLACEHOLDER")); 53Assert.Throws<ArgumentException>(() => cacheControl.PrivateHeaders.Add(null)); 54Assert.Throws<FormatException>(() => cacheControl.PrivateHeaders.Add("invalid PLACEHOLDER")); 61Assert.Throws<ArgumentNullException>(() => cacheControl.Extensions.Add(null!));
ContentDispositionHeaderValueTest.cs (1)
59Assert.Throws<ArgumentNullException>(() => contentDisposition.Parameters.Add(null!));
HeaderUtilitiesTest.cs (2)
287Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString(input); }); 293Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString($"{(char)0x7F}"); });
MediaTypeHeaderValueTest.cs (4)
123Assert.Throws<ArgumentNullException>(() => mediaType.Parameters.Add(null!)); 149Assert.Throws<InvalidOperationException>(() => { mediaType1.MediaType = "some/value"; }); 184Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Add(new NameValueHeaderValue("name"))); 186Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Clear());
NameValueHeaderValueTest.cs (5)
89Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; }); 122Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; }); 145Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = " x "; }); 146Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = "x y"; }); 615Assert.Throws<FormatException>(() => header.SetAndEscapeValue(input));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
CodeModel\FileCodeImportTests.cs (2)
35Assert.Throws<COMException>(() => { var value = import.Name; }); 42Assert.Throws<COMException>(() => { var value = import.FullName; });
PresentationCore.Tests (2)
System\Windows\Media\Imaging\BitmapImage.Tests.cs (2)
30Assert.Throws<NotSupportedException>(image.EndInit); 76Assert.Throws<NotSupportedException>(image.EndInit);
Security.TransportSecurity.IntegrationTests (6)
Https\ClientCredentialTypeTests.4.1.0.cs (2)
118MessageSecurityException exception = Assert.Throws<MessageSecurityException>(() => 178ArgumentException exception = Assert.Throws<ArgumentException>(() =>
Https\HttpsTests.4.1.0.cs (1)
337Assert.Throws<SecurityNegotiationException>(() => { _ = serviceProxy.Echo(testString); });
Negotiate\NegotiateStream_Http_Tests.4.1.0.cs (1)
86Assert.Throws<System.ServiceModel.ProtocolException>(() => { result = serviceProxy.Echo(testString); });
Tcp\IdentityTests.4.1.1.cs (1)
36var exception = Assert.Throws<MessageSecurityException>(() =>
Tcp\StreamingTests.4.1.0.cs (1)
221Assert.Throws<TimeoutException>(() =>
Shared.Tests (4)
EmptyCollections\EmptyReadonlyDictionaryTests.cs (3)
37Assert.Throws<NotSupportedException>(() => dict.Add(1, "One")); 48Assert.Throws<NotSupportedException>(() => dict.Add(1, "One")); 60Assert.Throws<NotSupportedException>(() => coll.Add(new KeyValuePair<int, string>(1, "One")));
EmptyCollections\EmptyReadOnlyListTests.cs (1)
57Assert.Throws<NotSupportedException>(() => coll.Add(1));
Sockets.BindTests (5)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (5)
556var exception = Assert.Throws<IOException>(() => host.Start()); 591var exception = Assert.Throws<IOException>(() => host.Start()); 758Assert.Throws<InvalidOperationException>(() => host.Start()); 783Assert.Throws<InvalidOperationException>(() => host.Start()); 973var exception = Assert.Throws<IOException>(() => host.Start());
System.ServiceModel.Http.Tests (1)
ServiceModel\SecurityBindingElementTest.cs (1)
36Assert.Throws<PlatformNotSupportedException>(() =>
System.ServiceModel.NetTcp.Tests (2)
ServiceModel\MessageSecurityOverTcpTest.cs (2)
23Assert.Throws <PlatformNotSupportedException>(() => 35Assert.Throws<PlatformNotSupportedException>(() =>
System.ServiceModel.Primitives.Tests (28)
Channels\CommunicationObjectTest.cs (4)
316InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 343InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 368InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 399InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() =>
Channels\CustomBindingTest.cs (1)
56Assert.Throws<ArgumentException>(() =>
Channels\CustomChannelTest.cs (4)
245InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 299InvalidOperationException actualException = Assert.Throws<InvalidOperationException>(() => 623Assert.Throws<InvalidOperationException>(() => ((IClientChannel)channel).Open()); 676Assert.Throws<InvalidOperationException>(() => ((IClientChannel)channel).DisplayInitializationUI());
Description\OperationContractAttributeTest.cs (2)
30var exception = Assert.Throws<InvalidOperationException>(() => 43var exception = Assert.Throws<InvalidOperationException>(() =>
IdentityModel\SecurityTokenSerializerTest.cs (3)
66Assert.Throws<ArgumentNullException>(() => sts.WriteToken(null, null)); 67Assert.Throws<ArgumentNullException>(() => sts.WriteKeyIdentifier(null, null)); 68Assert.Throws<ArgumentNullException>(() => sts.WriteKeyIdentifierClause(null, null));
ServiceModel\DeliveryRequirementsTest.cs (3)
29Assert.Throws<InvalidOperationException>(() => factory.Open()); 59Assert.Throws<InvalidOperationException>(() => factory.Open()); 68Assert.Throws<InvalidOperationException>(() => factory.Open());
ServiceModel\DuplexChannelFactoryTest.cs (5)
28Assert.Throws<InvalidOperationException>(() => 46Assert.Throws<UriFormatException>(() => 58Assert.Throws<UriFormatException>(() => 103var exception = Assert.Throws<InvalidOperationException>(() => 133Assert.Throws<InvalidOperationException>(() =>
ServiceModel\SynchronizedCollection.cs (6)
96Assert.Throws<ArgumentOutOfRangeException>(() => 101Assert.Throws<ArgumentOutOfRangeException>(() => 106Assert.Throws<ArgumentOutOfRangeException>(() => 111Assert.Throws<ArgumentOutOfRangeException>(() => 118Assert.Throws<ArgumentOutOfRangeException>(() => 123Assert.Throws<ArgumentOutOfRangeException>(() =>
System.Xaml.Tests (29)
System\Xaml\Schema\XamlMemberInvokerTests.cs (2)
147Assert.Throws<NotSupportedException>(() => invoker.SetValue(instance, 1)); 154Assert.Throws<NotSupportedException>(() => invoker.SetValue(new object(), "value"));
System\Xaml\Schema\XamlTypeInvokerTests.cs (6)
85Assert.Throws<NotSupportedException>(() => invoker.AddToCollection(new object(), 1)); 92Assert.Throws<NotSupportedException>(() => invoker.AddToCollection(new object(), 1)); 99Assert.Throws<XamlSchemaException>(() => invoker.AddToCollection(new GetEnumeratorClass(), "a")); 135Assert.Throws<NotSupportedException>(() => invoker.AddToDictionary(new object(), 1, 2)); 142Assert.Throws<NotSupportedException>(() => invoker.AddToDictionary(new object(), 1, 2)); 149Assert.Throws<XamlSchemaException>(() => invoker.AddToDictionary(new GetEnumeratorClass(), new object(), "a"));
System\Xaml\XamlBackgroundReaderTests.cs (2)
301Assert.Throws<InvalidOperationException>(() => reader.StartThread()); 316Assert.Throws<ObjectDisposedException>(() => reader.Close());
System\Xaml\XamlDirectiveTests.cs (1)
92Assert.Throws<NotSupportedException>(() => directive.Invoker.SetValue(null, null));
System\Xaml\XamlNodeListTests.cs (8)
265Assert.Throws<ObjectDisposedException>(() => writer.WriteGetObject()); 295Assert.Throws<ObjectDisposedException>(() => writer.WriteStartObject(null)); 325Assert.Throws<ObjectDisposedException>(() => writer.WriteEndObject()); 355Assert.Throws<ObjectDisposedException>(() => writer.WriteStartMember(null)); 385Assert.Throws<ObjectDisposedException>(() => writer.WriteEndMember()); 415Assert.Throws<ObjectDisposedException>(() => writer.WriteValue(null)); 446Assert.Throws<ObjectDisposedException>(() => writer.WriteNamespace(null)); 542Assert.Throws<ObjectDisposedException>(() => consumer.SetLineInfo(1, 2));
System\Xaml\XamlNodeQueueTests.cs (8)
121Assert.Throws<ObjectDisposedException>(() => writer.WriteGetObject()); 159Assert.Throws<ObjectDisposedException>(() => writer.WriteStartObject(null)); 188Assert.Throws<ObjectDisposedException>(() => writer.WriteEndObject()); 226Assert.Throws<ObjectDisposedException>(() => writer.WriteStartMember(null)); 255Assert.Throws<ObjectDisposedException>(() => writer.WriteEndMember()); 291Assert.Throws<ObjectDisposedException>(() => writer.WriteValue(null)); 329Assert.Throws<ObjectDisposedException>(() => writer.WriteNamespace(null)); 451Assert.Throws<ObjectDisposedException>(() => consumer.SetLineInfo(1, 2));
System\Xaml\XamlReaderTests.cs (1)
52Assert.Throws<XamlInternalException>(() => reader.Skip());
System\Xaml\XamlWriterTests.cs (1)
92Assert.Throws<NotImplementedException>(() => writer.WriteNode(reader));
WindowsBase.Tests (172)
System\ComponentModel\CurrentChangingEventManagerTests.cs (2)
381Assert.Throws<NullReferenceException>(() => CurrentChangingEventManager.AddHandler(null, handler)); 384Assert.Throws<NullReferenceException>(() => CurrentChangingEventManager.RemoveHandler(null, handler));
System\ComponentModel\PropertyChangedEventManagerTests.cs (2)
398Assert.Throws<NullReferenceException>(() => PropertyChangedEventManager.AddHandler(null, handler, "propertyName")); 401Assert.Throws<NullReferenceException>(() => PropertyChangedEventManager.AddHandler(null, handler, "propertyName"));
System\ComponentModel\SortDescriptionCollectionTests.cs (3)
791Assert.Throws<NotSupportedException>(() => collection.Add(new SortDescription("Name", ListSortDirection.Ascending))); 792Assert.Throws<NotSupportedException>(() => collection.Insert(0, new SortDescription("Name", ListSortDirection.Ascending))); 793Assert.Throws<NotSupportedException>(() => collection.Clear());
System\Windows\DependencyObjectTests.cs (19)
419Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 429Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 784Assert.Throws<InvalidOperationException>(() => obj.ClearValue(key)); 1161Assert.Throws<NullReferenceException>(() => obj.CoerceValue(null!)); 1190Assert.Throws<ArgumentException>(() => obj.CoerceValue(property)); 1229Assert.Throws<ArgumentException>(() => obj.CoerceValue(property)); 1240Assert.Throws<InvalidOperationException>(() => obj.CoerceValue(property)); 1721Assert.Throws<InvalidOperationException>(() => obj.InvalidateProperty(property)); 1752Assert.Throws<ArgumentException>(() => obj.InvalidateProperty(property)); 1757Assert.Throws<ArgumentException>(() => obj.InvalidateProperty(property)); 2394Assert.Throws<InvalidOperationException>(() => obj.SetValue(property, "value")); 2406Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 2417Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 2433Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 2443Assert.Throws<InvalidOperationException>(() => obj.SetValue(property, "value")); 2829Assert.Throws<ArgumentException>(() => obj.SetValue(key, value)); 2840Assert.Throws<ArgumentException>(() => obj.SetValue(key, value)); 2856Assert.Throws<ArgumentException>(() => obj.SetValue(key, value)); 2866Assert.Throws<InvalidOperationException>(() => obj.SetValue(key, "value"));
System\Windows\DependencyPropertyKeyTests.cs (3)
43Assert.Throws<ArgumentException>(() => key.OverrideMetadata(forType, new PropertyMetadata())); 58Assert.Throws<ArgumentException>(() => key.OverrideMetadata(typeof(int), property.DefaultMetadata)); 65Assert.Throws<ArgumentException>(() => key.OverrideMetadata(typeof(DependencyObject), new PropertyMetadata()));
System\Windows\FreezableTests.cs (85)
58Assert.Throws<InvalidOperationException>(() => freezable.Changed += handler); 59Assert.Throws<InvalidOperationException>(() => freezable.Changed += null); 60Assert.Throws<InvalidOperationException>(() => freezable.Changed -= handler); 61Assert.Throws<InvalidOperationException>(() => freezable.Changed -= null); 74Assert.Throws<InvalidOperationException>(() => freezable.Changed += handler); 75Assert.Throws<InvalidOperationException>(() => freezable.Changed += null); 76Assert.Throws<InvalidOperationException>(() => freezable.Changed -= handler); 77Assert.Throws<InvalidOperationException>(() => freezable.Changed -= null); 91Assert.Throws<InvalidOperationException>(() => freezable.Changed += handler); 92Assert.Throws<InvalidOperationException>(() => freezable.Changed += null); 93Assert.Throws<InvalidOperationException>(() => freezable.Changed -= handler); 94Assert.Throws<InvalidOperationException>(() => freezable.Changed -= null); 815Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 825Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 835Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 848Assert.Throws<InvalidOperationException>(() => obj.ClearValue(property)); 1290Assert.Throws<InvalidOperationException>(() => obj.ClearValue(key)); 1301Assert.Throws<InvalidOperationException>(() => obj.ClearValue(key)); 1314Assert.Throws<InvalidOperationException>(() => obj.ClearValue(key)); 1911Assert.Throws<InvalidOperationException>(() => freezable.CloneCore(sourceFreezable)); 1995Assert.Throws<InvalidOperationException>(() => freezable.CloneCore(sourceFreezable)); 2085Assert.Throws<InvalidOperationException>(() => freezable.CloneCore(sourceFreezable)); 2175Assert.Throws<InvalidOperationException>(() => freezable.CloneCore(sourceFreezable)); 2201Assert.Throws<NullReferenceException>(() => freezable.CloneCore(null!)); 2794Assert.Throws<InvalidOperationException>(() => freezable.CloneCurrentValueCore(sourceFreezable)); 2879Assert.Throws<InvalidOperationException>(() => freezable.CloneCurrentValueCore(sourceFreezable)); 2970Assert.Throws<InvalidOperationException>(() => freezable.CloneCurrentValueCore(sourceFreezable)); 3061Assert.Throws<InvalidOperationException>(() => freezable.CloneCurrentValueCore(sourceFreezable)); 3087Assert.Throws<NullReferenceException>(() => freezable.CloneCurrentValueCore(null!)); 3564Assert.Throws<NullReferenceException>(() => obj.CoerceValue(null!)); 3593Assert.Throws<ArgumentException>(() => obj.CoerceValue(property)); 3632Assert.Throws<ArgumentException>(() => obj.CoerceValue(property)); 3659Assert.Throws<InvalidOperationException>(() => obj.CoerceValue(property)); 3819Assert.Throws<InvalidOperationException>(() => freezable.Freeze()); 3843Assert.Throws<InvalidOperationException>(() => freezable.Freeze()); 4017Assert.Throws<InvalidOperationException>(() => freezable.Freeze()); 4063Assert.Throws<InvalidOperationException>(() => freezable.Freeze()); 4907Assert.Throws<InvalidOperationException>(() => freezable.GetAsFrozenCore(sourceFreezable)); 4992Assert.Throws<InvalidOperationException>(() => freezable.GetAsFrozenCore(sourceFreezable)); 5083Assert.Throws<InvalidOperationException>(() => freezable.GetAsFrozenCore(sourceFreezable)); 5174Assert.Throws<InvalidOperationException>(() => freezable.GetAsFrozenCore(sourceFreezable)); 5200Assert.Throws<NullReferenceException>(() => freezable.GetAsFrozenCore(null!)); 5760Assert.Throws<InvalidOperationException>(() => freezable.GetCurrentValueAsFrozenCore(sourceFreezable)); 5845Assert.Throws<InvalidOperationException>(() => freezable.GetCurrentValueAsFrozenCore(sourceFreezable)); 5936Assert.Throws<InvalidOperationException>(() => freezable.GetCurrentValueAsFrozenCore(sourceFreezable)); 6026Assert.Throws<InvalidOperationException>(() => freezable.GetCurrentValueAsFrozenCore(sourceFreezable)); 6051Assert.Throws<NullReferenceException>(() => freezable.GetCurrentValueAsFrozenCore(null!)); 6235Assert.Throws<InvalidOperationException>(() => freezable.ReadPreamble()); 6364Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value1)); 6365Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value3)); 6368Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value1, value3)); 6370Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value1)); 6371Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value3)); 6373Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value3, value1)); 6419Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value1)); 6420Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value3)); 6423Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value1, value3)); 6425Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value1)); 6426Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value3)); 6428Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value3, value1)); 6540Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value1, property)); 6541Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value3, property)); 6544Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value1, value3, property)); 6546Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value1, property)); 6547Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value3, property)); 6549Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value3, value1, property)); 6597Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value1, property)); 6598Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(null!, value3, property)); 6601Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value1, value3, property)); 6603Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value1, property)); 6604Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value2, value3, property)); 6606Assert.Throws<InvalidOperationException>(() => freezable.OnFreezablePropertyChanged(value3, value1, property)); 6807Assert.Throws<InvalidOperationException>(() => obj.SetValue(property, "value")); 6819Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 6830Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 6846Assert.Throws<ArgumentException>(() => obj.SetValue(property, value)); 6858Assert.Throws<InvalidOperationException>(() => freezable.SetValue(property, true)); 6862Assert.Throws<InvalidOperationException>(() => freezable.SetValue(property, true)); 6866Assert.Throws<InvalidOperationException>(() => freezable.SetValue(property, false)); 6879Assert.Throws<InvalidOperationException>(() => freezable.SetValue(property, value)); 6894Assert.Throws<InvalidOperationException>(() => freezable.SetValue(property, value)); 7244Assert.Throws<InvalidOperationException>(() => freezable.WritePreamble()); 7247Assert.Throws<InvalidOperationException>(() => freezable.WritePreamble()); 7256Assert.Throws<InvalidOperationException>(() => freezable.WritePreamble()); 7268Assert.Throws<InvalidOperationException>(() => freezable.WritePreamble());
System\Windows\Media\MatrixTests.cs (1)
1231Assert.Throws<InvalidOperationException>(() => matrix.Invert());
System\Windows\NameScopeTests.cs (19)
190Assert.Throws<ArgumentException>(() => nameScope.Add(string.Empty, scopedElement)); 303Assert.Throws<ArgumentNullException>(() => nameScope.Add(null, scopedElement)); 311Assert.Throws<ArgumentException>(() => nameScope.Add(string.Empty, scopedElement)); 322Assert.Throws<ArgumentException>(() => nameScope.Add(name, scopedElement)); 405Assert.Throws<ArgumentException>(() => nameScope.Add(new KeyValuePair<string, object>(string.Empty, scopedElement))); 416Assert.Throws<ArgumentException>(() => nameScope.Add(new KeyValuePair<string, object>(name, scopedElement))); 432Assert.Throws<ArgumentException>(() => nameScope.Add("name", new object())); 433Assert.Throws<ArgumentException>(() => nameScope.Add(new KeyValuePair<string, object>("name", new object()))); 532Assert.Throws<NullReferenceException>(() => nameScope.CopyTo(null, 0)); 543Assert.Throws<IndexOutOfRangeException>(() => nameScope.CopyTo(array, 0)); 554Assert.Throws<IndexOutOfRangeException>(() => nameScope.CopyTo(array, -1)); 555Assert.Throws<IndexOutOfRangeException>(() => nameScope.CopyTo(array, 1)); 908Assert.Throws<ArgumentException>(() => nameScope.RegisterName(string.Empty, scopedElement)); 919Assert.Throws<ArgumentException>(() => nameScope.RegisterName(name, scopedElement)); 935Assert.Throws<ArgumentException>(() => nameScope.RegisterName("name", new object())); 1136Assert.Throws<ArgumentException>(() => nameScope.UnregisterName("name")); 1152Assert.Throws<ArgumentException>(() => nameScope.UnregisterName(string.Empty)); 1168Assert.Throws<ArgumentException>(() => nameScope.UnregisterName(name)); 1186Assert.Throws<ArgumentException>(() => nameScope.UnregisterName(name));
System\Windows\PropertyMetadataTests.cs (1)
507Assert.Throws<InvalidOperationException>(() => metadata.Merge(new PropertyMetadata(), null!));
System\Windows\RectTests.cs (4)
1807Assert.Throws<InvalidOperationException>(() => Rect.Empty.Inflate(0, 0)); 1808Assert.Throws<InvalidOperationException>(() => Rect.Empty.Inflate(new Size(0, 0))); 2752Assert.Throws<InvalidOperationException>(() => Rect.Empty.Offset(0, 0)); 2753Assert.Throws<InvalidOperationException>(() => Rect.Empty.Offset(new Vector(0, 0)));
System\Windows\SplashScreenTests.cs (6)
71Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(false)); 72Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(true)); 73Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(false, false)); 74Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(false, true)); 75Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(true, false)); 76Assert.Throws<MissingManifestResourceException>(() => splashScreen.Show(true, true));
System\Windows\Threading\DispatcherPriorityAwaiterTests.cs (5)
131Assert.Throws<ArgumentNullException>(() => awaiter.OnCompleted(null)); 139Assert.Throws<InvalidOperationException>(() => awaiter.OnCompleted(null)); 140Assert.Throws<InvalidOperationException>(() => awaiter.OnCompleted(() => { })); 147Assert.Throws<InvalidOperationException>(() => awaiter.OnCompleted(null)); 148Assert.Throws<InvalidOperationException>(() => awaiter.OnCompleted(() => { }));
System\Windows\Threading\DispatcherTests.cs (1)
83Assert.Throws<InvalidEnumArgumentException>(() => Dispatcher.ValidatePriority(priority, null));
System\Windows\WeakEventManagerTests.cs (14)
337Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 352Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 368Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 425Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 612Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 625Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 639Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 1237Assert.Throws<InvalidCastException>(() => manager.ProtectedAddHandler(source, handler)); 1602Assert.Throws<InvalidCastException>(() => manager.ProtectedAddListener(source, listener)); 2141Assert.Throws<InvalidCastException>(() => manager.ProtectedRemoveHandler(source, handler)); 2565Assert.Throws<InvalidCastException>(() => manager.ProtectedRemoveListener(source, listener)); 3912Assert.Throws<NullReferenceException>(() => list.AddHandler(null)); 4294Assert.Throws<NullReferenceException>(() => list.CopyTo(null!)); 5641Assert.Throws<NullReferenceException>(() => list.RemoveHandler(null));
System\Windows\WeakEventManagerTTests.cs (7)
189Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.AddHandler(new object(), null, (sender, e) => { })); 192Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.AddHandler(new object(), null, (sender, e) => { })); 213Assert.Throws<ArgumentException>(() => WeakEventManager<object, EventArgs>.AddHandler(source, eventName, handler)); 216Assert.Throws<ArgumentException>(() => WeakEventManager<object, EventArgs>.AddHandler(source, eventName, handler)); 351Assert.Throws<NullReferenceException>(() => WeakEventManager<object, EventArgs>.RemoveHandler(new object(), null, (sender, e) => { })); 372Assert.Throws<ArgumentException>(() => WeakEventManager<object, EventArgs>.RemoveHandler(source, eventName, handler)); 375Assert.Throws<ArgumentException>(() => WeakEventManager<object, EventArgs>.RemoveHandler(source, eventName, handler));
xunit.assert (1)
ExceptionAsserts.cs (1)
141 var ex = Throws<T>(testCode);