當前位置: 首頁>>代碼示例>>C#>>正文


C# ContentResult.Should方法代碼示例

本文整理匯總了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);
        }
開發者ID:rikrak,項目名稱:FluentAssertions.MVC,代碼行數:12,代碼來源:ContentResultAssertions_Tests.cs

示例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);
        }
開發者ID:rikrak,項目名稱:FluentAssertions.MVC,代碼行數:12,代碼來源:ContentResultAssertions_Tests.cs

示例3: BeContent_GivenContent_ShouldPass

 public void BeContent_GivenContent_ShouldPass()
 {
     ActionResult result = new ContentResult();
     result.Should()
             .BeContentResult();
 }
開發者ID:jrnail23,項目名稱:FluentAssertions.MVC,代碼行數:6,代碼來源:ActionResultAssertions_Tests.cs

示例4: WithContentEncoding_GivenExpected_ShouldPass

 public void WithContentEncoding_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult { ContentEncoding = Encoding.ASCII };
     result.Should().BeContentResult().WithContentEncoding(Encoding.ASCII);
 }
開發者ID:rikrak,項目名稱:FluentAssertions.MVC,代碼行數:5,代碼來源:ContentResultAssertions_Tests.cs

示例5: WithContentType_GivenExpected_ShouldPass

 public void WithContentType_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult { ContentType = "text/html" };
     result.Should().BeContentResult().WithContentType("text/html");
 }
開發者ID:rikrak,項目名稱:FluentAssertions.MVC,代碼行數:5,代碼來源:ContentResultAssertions_Tests.cs

示例6: WithContent_GivenExpected_ShouldPass

 public void WithContent_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult {Content = "content"};
     result.Should().BeContentResult().WithContent("content");
 }
開發者ID:rikrak,項目名稱:FluentAssertions.MVC,代碼行數:5,代碼來源:ContentResultAssertions_Tests.cs


注:本文中的System.Web.Mvc.ContentResult.Should方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。