public async Task GivenHttpResponseOtherThanInternalServerError_WhenGetContentInfo_ThenIsEmpty() { // Arrange var response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK }; var sut = new InternalServerErrorProcessor(response, response.Content); var contentBuilder = new StringBuilder(); // Act await sut.GetContentInfo(contentBuilder); // Assert contentBuilder.ToString().Should().BeEmpty(); }
public async Task GivenHttpResponseWithContentThatDoesNotDescribeAKnownError_WhenGetContentInfo_ThenIsEmpty() { // Arrange var response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent("the content") }; var sut = new InternalServerErrorProcessor(response, response.Content); var contentBuilder = new StringBuilder(); // Act await sut.GetContentInfo(contentBuilder); // Assert contentBuilder.ToString().Should().BeEmpty(); }
public async Task GivenHttpResponseWithRawTextDeveloperPage_WhenGetContentInfo_ThenExceptionDetailsAreExtracted() { // Arrange var response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(RawTextInternalServerErrorResponse) }; var sut = new InternalServerErrorProcessor(response, response.Content); var contentBuilder = new StringBuilder(); // Act await sut.GetContentInfo(contentBuilder); // Assert contentBuilder.ToString().Should() .Match("*System.Exception: Wow!*DeveloperExceptionPageMiddleware*") .And.NotContain("HEADERS"); }