本文整理汇总了C#中EmptyController.Content方法的典型用法代码示例。如果您正苦于以下问题:C# EmptyController.Content方法的具体用法?C# EmptyController.Content怎么用?C# EmptyController.Content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmptyController
的用法示例。
在下文中一共展示了EmptyController.Content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContentWithContentString
public void ContentWithContentString() {
// Arrange
Controller controller = new EmptyController();
string content = "Some content";
// Act
ContentResult result = controller.Content(content);
// Assert
Assert.AreEqual(content, result.Content);
}
示例2: ContentWithContentStringAndContentType
public void ContentWithContentStringAndContentType()
{
// Arrange
Controller controller = new EmptyController();
string content = "Some content";
string contentType = "Some content type";
// Act
ContentResult result = controller.Content(content, contentType);
// Assert
Assert.Equal(content, result.Content);
Assert.Equal(contentType, result.ContentType);
}
示例3: ContentWithContentStringAndContentTypeAndEncoding
public void ContentWithContentStringAndContentTypeAndEncoding() {
// Arrange
Controller controller = new EmptyController();
string content = "Some content";
string contentType = "Some content type";
Encoding contentEncoding = Encoding.UTF8;
// Act
ContentResult result = controller.Content(content, contentType, contentEncoding);
// Assert
Assert.AreEqual(content, result.Content);
Assert.AreEqual(contentType, result.ContentType);
Assert.AreSame(contentEncoding, result.ContentEncoding);
}