Beispiel #1
0
        public async Task InvokeAsync_NextThrowException_ReturnsStatusCode500([Frozen] RequestDelegate next,
                                                                              HttpContext context,
                                                                              ExceptionMiddleware sut)
        {
            next.WhenForAnyArgs(x => x(Arg.Any <HttpContext>())).Throw(new Exception());
            Func <Task> func = async() => await sut.InvokeAsync(context).ConfigureAwait(false);

            await func.Should().NotThrowAsync().ConfigureAwait(false);

            context.Response.StatusCode.Should().Be((int)HttpStatusCode.InternalServerError);
        }