示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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");
        }