本文整理匯總了C#中System.Web.Mvc.ContentResult.Should方法的典型用法代碼示例。如果您正苦於以下問題:C# ContentResult.Should方法的具體用法?C# ContentResult.Should怎麽用?C# ContentResult.Should使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.Mvc.ContentResult
的用法示例。
在下文中一共展示了ContentResult.Should方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WithContentEncoding_GivenUnexpected_ShouldFail
public void WithContentEncoding_GivenUnexpected_ShouldFail()
{
var actualEncoding = Encoding.ASCII;
var expectedEncoding = Encoding.Unicode;
ActionResult result = new ContentResult { ContentEncoding = actualEncoding };
var failureMessage = String.Format(FailureMessages.CommonFailMessage, "ContentResult.ContentEncoding", expectedEncoding, actualEncoding);
Action a = () => result.Should().BeContentResult().WithContentEncoding(expectedEncoding);
a.ShouldThrow<Exception>()
.WithMessage(failureMessage);
}
示例2: WithContentType_GivenUnexpected_ShouldFail
public void WithContentType_GivenUnexpected_ShouldFail()
{
var actualContentType = "text/html";
var expectedContentType = "xyz";
ActionResult result = new ContentResult { ContentType = actualContentType };
var failureMessage = String.Format(FailureMessages.CommonFailMessage, "ContentResult.ContentType", expectedContentType, actualContentType);
Action a = () => result.Should().BeContentResult().WithContentType(expectedContentType);
a.ShouldThrow<Exception>()
.WithMessage(failureMessage);
}
示例3: BeContent_GivenContent_ShouldPass
public void BeContent_GivenContent_ShouldPass()
{
ActionResult result = new ContentResult();
result.Should()
.BeContentResult();
}
示例4: WithContentEncoding_GivenExpected_ShouldPass
public void WithContentEncoding_GivenExpected_ShouldPass()
{
ActionResult result = new ContentResult { ContentEncoding = Encoding.ASCII };
result.Should().BeContentResult().WithContentEncoding(Encoding.ASCII);
}
示例5: WithContentType_GivenExpected_ShouldPass
public void WithContentType_GivenExpected_ShouldPass()
{
ActionResult result = new ContentResult { ContentType = "text/html" };
result.Should().BeContentResult().WithContentType("text/html");
}
示例6: WithContent_GivenExpected_ShouldPass
public void WithContent_GivenExpected_ShouldPass()
{
ActionResult result = new ContentResult {Content = "content"};
result.Should().BeContentResult().WithContent("content");
}