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