diff options
author | Pranav K <prkrishn@hotmail.com> | 2021-11-06 03:52:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-06 03:52:08 +0300 |
commit | a450cb69b5e4549f5515cdb057a68771f56cefd7 (patch) | |
tree | b31cc4cd3257b8aeec14a5481121dac6964195a6 /src/Http/Http.Abstractions/test/UseMiddlewareTest.cs | |
parent | b9fcd82fe9d0883e9828864a8e8b2231f469254f (diff) |
Use file scoped namespaces (#38076)
* Use file scoped namespaces
Diffstat (limited to 'src/Http/Http.Abstractions/test/UseMiddlewareTest.cs')
-rw-r--r-- | src/Http/Http.Abstractions/test/UseMiddlewareTest.cs | 601 |
1 files changed, 300 insertions, 301 deletions
diff --git a/src/Http/Http.Abstractions/test/UseMiddlewareTest.cs b/src/Http/Http.Abstractions/test/UseMiddlewareTest.cs index 0c89b00e32..5c2dab0b6e 100644 --- a/src/Http/Http.Abstractions/test/UseMiddlewareTest.cs +++ b/src/Http/Http.Abstractions/test/UseMiddlewareTest.cs @@ -9,368 +9,367 @@ using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http.Abstractions; using Xunit; -namespace Microsoft.AspNetCore.Http +namespace Microsoft.AspNetCore.Http; + +public class UseMiddlewareTest { - public class UseMiddlewareTest + [Fact] + public void UseMiddleware_WithNoParameters_ThrowsException() { - [Fact] - public void UseMiddleware_WithNoParameters_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareNoParametersStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddlewareNoParameters( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName, - nameof(HttpContext)), - exception.Message); - } - - [Fact] - public void UseMiddleware_AsyncWithNoParameters_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareAsyncNoParametersStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddlewareNoParameters( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName, - nameof(HttpContext)), - exception.Message); - } + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareNoParametersStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddlewareNoParameters( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName, + nameof(HttpContext)), + exception.Message); + } - [Fact] - public void UseMiddleware_NonTaskReturnType_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareNonTaskReturnStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddlewareNonTaskReturnType( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName, - nameof(Task)), - exception.Message); - } + [Fact] + public void UseMiddleware_AsyncWithNoParameters_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareAsyncNoParametersStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddlewareNoParameters( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName, + nameof(HttpContext)), + exception.Message); + } - [Fact] - public void UseMiddleware_AsyncNonTaskReturnType_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareAsyncNonTaskReturnStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddlewareNonTaskReturnType( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName, - nameof(Task)), - exception.Message); - } + [Fact] + public void UseMiddleware_NonTaskReturnType_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareNonTaskReturnStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddlewareNonTaskReturnType( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName, + nameof(Task)), + exception.Message); + } - [Fact] - public void UseMiddleware_NoInvokeOrInvokeAsyncMethod_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareNoInvokeStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddlewareNoInvokeMethod( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName, typeof(MiddlewareNoInvokeStub)), - exception.Message); - } + [Fact] + public void UseMiddleware_AsyncNonTaskReturnType_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareAsyncNonTaskReturnStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddlewareNonTaskReturnType( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName, + nameof(Task)), + exception.Message); + } - [Fact] - public void UseMiddleware_MultipleInvokeMethods_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareMultipleInvokesStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddleMutlipleInvokes( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName), - exception.Message); - } + [Fact] + public void UseMiddleware_NoInvokeOrInvokeAsyncMethod_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareNoInvokeStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddlewareNoInvokeMethod( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName, typeof(MiddlewareNoInvokeStub)), + exception.Message); + } - [Fact] - public void UseMiddleware_MultipleInvokeAsyncMethods_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAsyncStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddleMutlipleInvokes( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName), - exception.Message); - } + [Fact] + public void UseMiddleware_MultipleInvokeMethods_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareMultipleInvokesStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddleMutlipleInvokes( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName), + exception.Message); + } - [Fact] - public void UseMiddleware_MultipleInvokeAndInvokeAsyncMethods_ThrowsException() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAndInvokeAsyncStub)); - var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); - - Assert.Equal( - Resources.FormatException_UseMiddleMutlipleInvokes( - UseMiddlewareExtensions.InvokeMethodName, - UseMiddlewareExtensions.InvokeAsyncMethodName), - exception.Message); - } + [Fact] + public void UseMiddleware_MultipleInvokeAsyncMethods_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAsyncStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddleMutlipleInvokes( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName), + exception.Message); + } - [Fact] - public async Task UseMiddleware_ThrowsIfArgCantBeResolvedFromContainer() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareInjectInvokeNoService)); - var app = builder.Build(); - var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => app(new DefaultHttpContext())); - Assert.Equal( - Resources.FormatException_InvokeMiddlewareNoService( - typeof(object), - typeof(MiddlewareInjectInvokeNoService)), - exception.Message); - } + [Fact] + public void UseMiddleware_MultipleInvokeAndInvokeAsyncMethods_ThrowsException() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAndInvokeAsyncStub)); + var exception = Assert.Throws<InvalidOperationException>(() => builder.Build()); + + Assert.Equal( + Resources.FormatException_UseMiddleMutlipleInvokes( + UseMiddlewareExtensions.InvokeMethodName, + UseMiddlewareExtensions.InvokeAsyncMethodName), + exception.Message); + } - [Fact] - public void UseMiddlewareWithInvokeArg() - { - var builder = new ApplicationBuilder(new DummyServiceProvider()); - builder.UseMiddleware(typeof(MiddlewareInjectInvoke)); - var app = builder.Build(); - app(new DefaultHttpContext()); - } + [Fact] + public async Task UseMiddleware_ThrowsIfArgCantBeResolvedFromContainer() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareInjectInvokeNoService)); + var app = builder.Build(); + var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => app(new DefaultHttpContext())); + Assert.Equal( + Resources.FormatException_InvokeMiddlewareNoService( + typeof(object), + typeof(MiddlewareInjectInvokeNoService)), + exception.Message); + } - [Fact] - public void UseMiddlewareWithInvokeWithOutAndRefThrows() - { - var mockServiceProvider = new DummyServiceProvider(); - var builder = new ApplicationBuilder(mockServiceProvider); - builder.UseMiddleware(typeof(MiddlewareInjectWithOutAndRefParams)); - var exception = Assert.Throws<NotSupportedException>(() => builder.Build()); - } + [Fact] + public void UseMiddlewareWithInvokeArg() + { + var builder = new ApplicationBuilder(new DummyServiceProvider()); + builder.UseMiddleware(typeof(MiddlewareInjectInvoke)); + var app = builder.Build(); + app(new DefaultHttpContext()); + } - [Fact] - public void UseMiddlewareWithIMiddlewareThrowsIfParametersSpecified() - { - var mockServiceProvider = new DummyServiceProvider(); - var builder = new ApplicationBuilder(mockServiceProvider); - var exception = Assert.Throws<NotSupportedException>(() => builder.UseMiddleware(typeof(Middleware), "arg")); - Assert.Equal(Resources.FormatException_UseMiddlewareExplicitArgumentsNotSupported(typeof(IMiddleware)), exception.Message); - } + [Fact] + public void UseMiddlewareWithInvokeWithOutAndRefThrows() + { + var mockServiceProvider = new DummyServiceProvider(); + var builder = new ApplicationBuilder(mockServiceProvider); + builder.UseMiddleware(typeof(MiddlewareInjectWithOutAndRefParams)); + var exception = Assert.Throws<NotSupportedException>(() => builder.Build()); + } - [Fact] - public async Task UseMiddlewareWithIMiddlewareThrowsIfNoIMiddlewareFactoryRegistered() - { - var mockServiceProvider = new DummyServiceProvider(); - var builder = new ApplicationBuilder(mockServiceProvider); - builder.UseMiddleware(typeof(Middleware)); - var app = builder.Build(); - var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () => - { - var context = new DefaultHttpContext(); - var sp = new DummyServiceProvider(); - context.RequestServices = sp; - await app(context); - }); - Assert.Equal(Resources.FormatException_UseMiddlewareNoMiddlewareFactory(typeof(IMiddlewareFactory)), exception.Message); - } + [Fact] + public void UseMiddlewareWithIMiddlewareThrowsIfParametersSpecified() + { + var mockServiceProvider = new DummyServiceProvider(); + var builder = new ApplicationBuilder(mockServiceProvider); + var exception = Assert.Throws<NotSupportedException>(() => builder.UseMiddleware(typeof(Middleware), "arg")); + Assert.Equal(Resources.FormatException_UseMiddlewareExplicitArgumentsNotSupported(typeof(IMiddleware)), exception.Message); + } - [Fact] - public async Task UseMiddlewareWithIMiddlewareThrowsIfMiddlewareFactoryCreateReturnsNull() + [Fact] + public async Task UseMiddlewareWithIMiddlewareThrowsIfNoIMiddlewareFactoryRegistered() + { + var mockServiceProvider = new DummyServiceProvider(); + var builder = new ApplicationBuilder(mockServiceProvider); + builder.UseMiddleware(typeof(Middleware)); + var app = builder.Build(); + var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () => { - var mockServiceProvider = new DummyServiceProvider(); - var builder = new ApplicationBuilder(mockServiceProvider); - builder.UseMiddleware(typeof(Middleware)); - var app = builder.Build(); - var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () => - { - var context = new DefaultHttpContext(); - var sp = new DummyServiceProvider(); - sp.AddService(typeof(IMiddlewareFactory), new BadMiddlewareFactory()); - context.RequestServices = sp; - await app(context); - }); - - Assert.Equal( - Resources.FormatException_UseMiddlewareUnableToCreateMiddleware( - typeof(BadMiddlewareFactory), - typeof(Middleware)), - exception.Message); - } + var context = new DefaultHttpContext(); + var sp = new DummyServiceProvider(); + context.RequestServices = sp; + await app(context); + }); + Assert.Equal(Resources.FormatException_UseMiddlewareNoMiddlewareFactory(typeof(IMiddlewareFactory)), exception.Message); + } - [Fact] - public async Task UseMiddlewareWithIMiddlewareWorks() + [Fact] + public async Task UseMiddlewareWithIMiddlewareThrowsIfMiddlewareFactoryCreateReturnsNull() + { + var mockServiceProvider = new DummyServiceProvider(); + var builder = new ApplicationBuilder(mockServiceProvider); + builder.UseMiddleware(typeof(Middleware)); + var app = builder.Build(); + var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () => { - var mockServiceProvider = new DummyServiceProvider(); - var builder = new ApplicationBuilder(mockServiceProvider); - builder.UseMiddleware(typeof(Middleware)); - var app = builder.Build(); var context = new DefaultHttpContext(); var sp = new DummyServiceProvider(); - var middlewareFactory = new BasicMiddlewareFactory(); - sp.AddService(typeof(IMiddlewareFactory), middlewareFactory); + sp.AddService(typeof(IMiddlewareFactory), new BadMiddlewareFactory()); context.RequestServices = sp; await app(context); - Assert.True(Assert.IsType<bool>(context.Items["before"])); - Assert.True(Assert.IsType<bool>(context.Items["after"])); - Assert.NotNull(middlewareFactory.Created); - Assert.NotNull(middlewareFactory.Released); - Assert.IsType<Middleware>(middlewareFactory.Created); - Assert.IsType<Middleware>(middlewareFactory.Released); - Assert.Same(middlewareFactory.Created, middlewareFactory.Released); - } + }); - public class Middleware : IMiddleware - { - public async Task InvokeAsync(HttpContext context, RequestDelegate next) - { - context.Items["before"] = true; - await next(context); - context.Items["after"] = true; - } - } + Assert.Equal( + Resources.FormatException_UseMiddlewareUnableToCreateMiddleware( + typeof(BadMiddlewareFactory), + typeof(Middleware)), + exception.Message); + } - public class BasicMiddlewareFactory : IMiddlewareFactory + [Fact] + public async Task UseMiddlewareWithIMiddlewareWorks() + { + var mockServiceProvider = new DummyServiceProvider(); + var builder = new ApplicationBuilder(mockServiceProvider); + builder.UseMiddleware(typeof(Middleware)); + var app = builder.Build(); + var context = new DefaultHttpContext(); + var sp = new DummyServiceProvider(); + var middlewareFactory = new BasicMiddlewareFactory(); + sp.AddService(typeof(IMiddlewareFactory), middlewareFactory); + context.RequestServices = sp; + await app(context); + Assert.True(Assert.IsType<bool>(context.Items["before"])); + Assert.True(Assert.IsType<bool>(context.Items["after"])); + Assert.NotNull(middlewareFactory.Created); + Assert.NotNull(middlewareFactory.Released); + Assert.IsType<Middleware>(middlewareFactory.Created); + Assert.IsType<Middleware>(middlewareFactory.Released); + Assert.Same(middlewareFactory.Created, middlewareFactory.Released); + } + + public class Middleware : IMiddleware + { + public async Task InvokeAsync(HttpContext context, RequestDelegate next) { - public IMiddleware? Created { get; private set; } - public IMiddleware? Released { get; private set; } + context.Items["before"] = true; + await next(context); + context.Items["after"] = true; + } + } - public IMiddleware? Create(Type middlewareType) - { - Created = Activator.CreateInstance(middlewareType) as IMiddleware; - return Created; - } + public class BasicMiddlewareFactory : IMiddlewareFactory + { + public IMiddleware? Created { get; private set; } + public IMiddleware? Released { get; private set; } - public void Release(IMiddleware middleware) - { - Released = middleware; - } + public IMiddleware? Create(Type middlewareType) + { + Created = Activator.CreateInstance(middlewareType) as IMiddleware; + return Created; } - public class BadMiddlewareFactory : IMiddlewareFactory + public void Release(IMiddleware middleware) { - public IMiddleware? Create(Type middlewareType) => null; - - public void Release(IMiddleware middleware) { } + Released = middleware; } + } - private class DummyServiceProvider : IServiceProvider - { - private readonly Dictionary<Type, object> _services = new Dictionary<Type, object>(); + public class BadMiddlewareFactory : IMiddlewareFactory + { + public IMiddleware? Create(Type middlewareType) => null; - public void AddService(Type type, object value) => _services[type] = value; + public void Release(IMiddleware middleware) { } + } - public object? GetService(Type serviceType) - { - if (serviceType == typeof(IServiceProvider)) - { - return this; - } - - if (_services.TryGetValue(serviceType, out var value)) - { - return value; - } - return null; - } - } + private class DummyServiceProvider : IServiceProvider + { + private readonly Dictionary<Type, object> _services = new Dictionary<Type, object>(); - public class MiddlewareInjectWithOutAndRefParams + public void AddService(Type type, object value) => _services[type] = value; + + public object? GetService(Type serviceType) { - public MiddlewareInjectWithOutAndRefParams(RequestDelegate next) { } + if (serviceType == typeof(IServiceProvider)) + { + return this; + } - public Task Invoke(HttpContext context, ref IServiceProvider? sp1, out IServiceProvider? sp2) + if (_services.TryGetValue(serviceType, out var value)) { - sp1 = null; - sp2 = null; - return Task.FromResult(0); + return value; } + return null; } + } - private class MiddlewareInjectInvokeNoService - { - public MiddlewareInjectInvokeNoService(RequestDelegate next) { } + public class MiddlewareInjectWithOutAndRefParams + { + public MiddlewareInjectWithOutAndRefParams(RequestDelegate next) { } - public Task Invoke(HttpContext context, object value) => Task.CompletedTask; + public Task Invoke(HttpContext context, ref IServiceProvider? sp1, out IServiceProvider? sp2) + { + sp1 = null; + sp2 = null; + return Task.FromResult(0); } + } - private class MiddlewareInjectInvoke - { - public MiddlewareInjectInvoke(RequestDelegate next) { } + private class MiddlewareInjectInvokeNoService + { + public MiddlewareInjectInvokeNoService(RequestDelegate next) { } - public Task Invoke(HttpContext context, IServiceProvider provider) => Task.CompletedTask; - } + public Task Invoke(HttpContext context, object value) => Task.CompletedTask; + } - private class MiddlewareNoParametersStub - { - public MiddlewareNoParametersStub(RequestDelegate next) { } + private class MiddlewareInjectInvoke + { + public MiddlewareInjectInvoke(RequestDelegate next) { } - public Task Invoke() => Task.CompletedTask; - } + public Task Invoke(HttpContext context, IServiceProvider provider) => Task.CompletedTask; + } - private class MiddlewareAsyncNoParametersStub - { - public MiddlewareAsyncNoParametersStub(RequestDelegate next) { } + private class MiddlewareNoParametersStub + { + public MiddlewareNoParametersStub(RequestDelegate next) { } - public Task InvokeAsync() => Task.CompletedTask; - } + public Task Invoke() => Task.CompletedTask; + } - private class MiddlewareNonTaskReturnStub - { - public MiddlewareNonTaskReturnStub(RequestDelegate next) { } + private class MiddlewareAsyncNoParametersStub + { + public MiddlewareAsyncNoParametersStub(RequestDelegate next) { } - public int Invoke() => 0; - } + public Task InvokeAsync() => Task.CompletedTask; + } - private class MiddlewareAsyncNonTaskReturnStub - { - public MiddlewareAsyncNonTaskReturnStub(RequestDelegate next) { } + private class MiddlewareNonTaskReturnStub + { + public MiddlewareNonTaskReturnStub(RequestDelegate next) { } - public int InvokeAsync() => 0; - } + public int Invoke() => 0; + } - private class MiddlewareNoInvokeStub - { - public MiddlewareNoInvokeStub(RequestDelegate next) { } - } + private class MiddlewareAsyncNonTaskReturnStub + { + public MiddlewareAsyncNonTaskReturnStub(RequestDelegate next) { } - private class MiddlewareMultipleInvokesStub - { - public MiddlewareMultipleInvokesStub(RequestDelegate next) { } + public int InvokeAsync() => 0; + } + + private class MiddlewareNoInvokeStub + { + public MiddlewareNoInvokeStub(RequestDelegate next) { } + } - public Task Invoke(HttpContext context) => Task.CompletedTask; + private class MiddlewareMultipleInvokesStub + { + public MiddlewareMultipleInvokesStub(RequestDelegate next) { } - public Task Invoke(HttpContext context, int i) => Task.CompletedTask; - } + public Task Invoke(HttpContext context) => Task.CompletedTask; - private class MiddlewareMultipleInvokeAsyncStub - { - public MiddlewareMultipleInvokeAsyncStub(RequestDelegate next) { } + public Task Invoke(HttpContext context, int i) => Task.CompletedTask; + } - public Task InvokeAsync(HttpContext context) => Task.CompletedTask; + private class MiddlewareMultipleInvokeAsyncStub + { + public MiddlewareMultipleInvokeAsyncStub(RequestDelegate next) { } - public Task InvokeAsync(HttpContext context, int i) => Task.CompletedTask; - } + public Task InvokeAsync(HttpContext context) => Task.CompletedTask; - private class MiddlewareMultipleInvokeAndInvokeAsyncStub - { - public MiddlewareMultipleInvokeAndInvokeAsyncStub(RequestDelegate next) { } + public Task InvokeAsync(HttpContext context, int i) => Task.CompletedTask; + } + + private class MiddlewareMultipleInvokeAndInvokeAsyncStub + { + public MiddlewareMultipleInvokeAndInvokeAsyncStub(RequestDelegate next) { } - public Task Invoke(HttpContext context) => Task.CompletedTask; + public Task Invoke(HttpContext context) => Task.CompletedTask; - public Task InvokeAsync(HttpContext context) => Task.CompletedTask; - } + public Task InvokeAsync(HttpContext context) => Task.CompletedTask; } } |