public void Controller_Content_WithParameterContentString_SetsResultContent() { // Arrange var controller = new TestableController(); // Act var actualContentResult = controller.Content("TestContent"); // Assert Assert.IsType<ContentResult>(actualContentResult); Assert.Equal("TestContent", actualContentResult.Content); Assert.Null(actualContentResult.ContentType); }
public void Controller_Content_WithParameterContentStringAndContentType_SetsResultContentAndContentType() { // Arrange var controller = new TestableController(); // Act var actualContentResult = controller.Content("TestContent", "text/plain"); // Assert Assert.IsType<ContentResult>(actualContentResult); Assert.Equal("TestContent", actualContentResult.Content); Assert.Null(actualContentResult.ContentType.Encoding); Assert.Equal("text/plain", actualContentResult.ContentType.ToString()); }
public void Controller_Content_WithParameterContentAndTypeAndEncoding_SetsResultContentAndTypeAndEncoding() { // Arrange var controller = new TestableController(); // Act var actualContentResult = controller.Content("TestContent", "text/plain", Encoding.UTF8); // Assert Assert.IsType<ContentResult>(actualContentResult); Assert.Equal("TestContent", actualContentResult.Content); Assert.Same(Encoding.UTF8, actualContentResult.ContentType.Encoding); Assert.Equal("text/plain; charset=utf-8", actualContentResult.ContentType.ToString()); }