コード例 #1
0
        public void ErrorResponseInApiThrows503()
        {
            // Arrange
            var httpResponseMessage     = StubFactory.GetStatusCodeResponseMessage(HttpStatusCode.NotFound);
            var questionnaireController = new QuestionnaireController(StubFactory.GetHttpClientContainer(httpResponseMessage));

            // Act
            var result = (ErrorViewModel)questionnaireController.Index().Result.ViewData.Model;

            // Assert
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.ServiceUnavailable));
            Assert.That(result.Message, Is.EqualTo("An underlying service is now unavailable. Please try again later."));
        }