public async Task ErrorInErrorPageWithoutPath()
        {
            // Arrange
            var cookies = new SimulatedErrorRequest(EndpointType.Pages, SimulatedErrorType.ExceptionInDedicatedErrorPage).GetCookies();

            // Act
            var response = await GetTestResponseAsync("/Errors/500", cookies);

            // Assert
            Validator.SimpleHtml(HttpStatusCode.InternalServerError);
        }
        public async Task SimulateError(EndpointType endpointType, SimulatedErrorType simulatedErrorType)
        {
            // Arrange
            var request = new SimulatedErrorRequest(endpointType, simulatedErrorType);

            // Act
            var response = await GetTestResponseAsync(request);

            // Assert
            if (!ExpectedSimulatedErrorResponses.TryGetValue(request, out var validator))
            {
                validator = Validator.PrettyInternalServerError();
            }

            validator(response);
        }
        public async Task ErrorInErrorPageWithPathToSelf()
        {
            // Arrange
            var cookies = new SimulatedErrorRequest(EndpointType.Pages, SimulatedErrorType.ExceptionInDedicatedErrorPage).GetCookies();

            // Act
            var response = await GetTestResponseAsync("/Errors/500?aspxerrorpath=/Errors/500", cookies);

            // Assert
            Validator.SimpleHtml(HttpStatusCode.InternalServerError)(response);
            Assert.Contains(
                "An exception occurred while processing your request. " +
                "Additionally, another exception occurred while executing the custom error page for the first exception. " +
                "The request has been terminated.",
                response.Content);
        }
 private async Task <TestResponse> GetTestResponseAsync(SimulatedErrorRequest errorRequest)
 {
     return(await GetTestResponseAsync(
                errorRequest.GetRelativePath(),
                errorRequest.GetCookies()));
 }