45 references to Throws
InMemory.FunctionalTests (1)
HttpsConnectionMiddlewareTests.cs (1)
1447Assert.Throws<NotSupportedException>(() => CreateMiddleware(httpConnectionAdapterOptions, HttpProtocols.Http2));
Microsoft.AspNetCore.Components.Tests (7)
Rendering\ArrayBuilderTest.cs (1)
295Assert.Throws<ObjectDisposedException>(() => builder.Append(1));
Routing\RouteTableFactoryTests.cs (6)
803Assert.Throws<InvalidOperationException>(() => new TestRouteTableBuilder() 821Assert.Throws<RoutePatternException>(() => new TestRouteTableBuilder() 836Assert.Throws<InvalidOperationException>(() => new TestRouteTableBuilder() 847var exception = Assert.Throws<InvalidOperationException>(() => new TestRouteTableBuilder() 900Assert.Throws<RoutePatternException>(() => new TestRouteTableBuilder() 1042var exception = Assert.Throws<InvalidOperationException>(() => new TestRouteTableBuilder()
Microsoft.AspNetCore.DataProtection.Extensions.Tests (3)
TimeLimitedDataProtectorTests.cs (3)
126var ex = Assert.Throws<CryptographicException>(() 143var ex = Assert.Throws<CryptographicException>(() 171Assert.Throws<CryptographicException>(() => timeLimitedProtector.Unprotect(ephemeralProtectedPayload, out actualExpiration));
Microsoft.AspNetCore.DataProtection.Tests (1)
ActivatorTests.cs (1)
62var ex = Assert.Throws<InvalidCastException>(
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
EndpointFilterInvocationContextOfTTests.cs (3)
16Assert.Throws<NotSupportedException>(() => context.Remove("string")); 17Assert.Throws<NotSupportedException>(() => context.Clear()); 43Assert.Throws<InvalidCastException>(() => context[0] = 4);
Microsoft.AspNetCore.Http.Extensions.Tests (6)
ParameterBindingMethodCacheTests.cs (6)
618var ex = Assert.Throws<InvalidOperationException>( 642var ex = Assert.Throws<InvalidOperationException>(() => cache.FindBindAsyncMethod(parameter)); 683var ex = Assert.Throws<InvalidOperationException>(() => cache.FindConstructor(type)); 693var ex = Assert.Throws<InvalidOperationException>(() => cache.FindConstructor(type)); 703var ex = Assert.Throws<InvalidOperationException>(() => cache.FindConstructor(type)); 715var ex = Assert.Throws<InvalidOperationException>(() => cache.FindConstructor(type));
Microsoft.AspNetCore.Http.Tests (1)
ResponseCookiesTest.cs (1)
270Assert.Throws<ArgumentException>(() => cookies.Append(key, "1"));
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
Infrastructure\DefaultPageHandlerMethodSelectorTest.cs (2)
661var ex = Assert.Throws<InvalidOperationException>(() => selector.Select(pageContext)); 721var ex = Assert.Throws<InvalidOperationException>(() => selector.Select(pageContext));
Microsoft.AspNetCore.Routing.Tests (4)
Builder\GroupTest.cs (4)
138var ex = Assert.Throws<ArgumentNullException>(() => builder.MapGroup((string)null!)); 140ex = Assert.Throws<ArgumentNullException>(() => builder.MapGroup((RoutePattern)null!)); 145ex = Assert.Throws<ArgumentNullException>(() => builder!.MapGroup(RoutePatternFactory.Parse("/"))); 147ex = Assert.Throws<ArgumentNullException>(() => builder!.MapGroup("/"));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (5)
Listener\RequestBodyTests.cs (1)
31Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(input, 0, input.Length));
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));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (7)
HttpRequestHeadersTests.cs (2)
401var exception = Assert.Throws<BadHttpRequestException>( 685Assert.Throws<InvalidOperationException>(() => headers.Append(acceptNameBytes, headerValueBytes, checkForNewlineChars: false));
HttpResponseHeadersTests.cs (2)
262Assert.Throws<InvalidOperationException>(() => ((IDictionary<string, StringValues>)headers).Add("my-header", new[] { "value" })); 325var exception = Assert.Throws<InvalidOperationException>(() => ((IHeaderDictionary)headers)["Content-Length"] = contentLength);
KestrelServerTests.cs (1)
318var exception = Assert.Throws<InvalidOperationException>(() =>
src\Shared\test\Shared.Tests\runtime\Http2\DynamicTableTest.cs (2)
67Assert.Throws<IndexOutOfRangeException>(() => dynamicTable[0]); 70Assert.Throws<IndexOutOfRangeException>(() => dynamicTable[1]);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (4)
QuicConnectionContextTests.cs (1)
733Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.Error = errorCode);
QuicStreamContextTests.cs (3)
554Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.Error = errorCode); 581Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.AbortRead(errorCode, new ConnectionAbortedException())); 582Assert.Throws<ArgumentOutOfRangeException>(() => protocolErrorCodeFeature.AbortWrite(errorCode, new ConnectionAbortedException()));
Microsoft.AspNetCore.SignalR.Tests (1)
Internal\MessageBufferTests.cs (1)
237Assert.Throws<InvalidOperationException>(() => messageBuffer.ShouldProcessMessage(new SequenceMessage(2)));