public async Task ShouldReturn500OnException() { Func <HttpRequestMessage, Task <HttpResponseMessage> > handler = request => { throw new Exception("hi"); }; var statusCode = HttpStatusCode.InternalServerError; var response = await Transmission.Handler(handler, new HttpRequestMessage()); Assert.Equal(statusCode, response.StatusCode); }