public void Process_Disabled() { // Arrange Configuration.DocumentationConfiguration.Setup(c => c.Disabled).Returns(true); var processor = new DocumentationPageRequestProcessor(Configuration.Object, null); // Act var result = processor.Process(null); // Assert Assert.That(result, Is.Not.Null, "A valid ResponseState should be returned."); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.NotFound), "The request should return a 404."); }
public void Process_Success() { // Arrange var testDocumentationContent = "Test documentation content."; Configuration.DocumentationConfiguration.Setup(c => c.Disabled).Returns(false); var htmlBuilder = Mocks.Create<IHtmlBuilder>(); htmlBuilder.Setup(b => b.CreateDocumentationPageHtml()).Returns(testDocumentationContent); var processor = new DocumentationPageRequestProcessor(Configuration.Object, htmlBuilder.Object); // Act var result = processor.Process(null); // Assert Assert.That(result, Is.Not.Null, "A valid ResponseState should be returned."); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK), "The request should be successful."); Assert.That(result.ContentType, Is.EqualTo(ContentTypes.Html), "The response should contain HTML."); Assert.That(result.Content, Is.EqualTo(testDocumentationContent), "The response content should contain the HtmlBuilder result."); }