コード例 #1
0
        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
0
        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
0
 public void BeContent_GivenContent_ShouldPass()
 {
     ActionResult result = new ContentResult();
     result.Should()
             .BeContentResult();
 }
コード例 #4
0
 public void WithContentEncoding_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult { ContentEncoding = Encoding.ASCII };
     result.Should().BeContentResult().WithContentEncoding(Encoding.ASCII);
 }
コード例 #5
0
 public void WithContentType_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult { ContentType = "text/html" };
     result.Should().BeContentResult().WithContentType("text/html");
 }
コード例 #6
0
 public void WithContent_GivenExpected_ShouldPass()
 {
     ActionResult result = new ContentResult {Content = "content"};
     result.Should().BeContentResult().WithContent("content");
 }