public void Ctor_Sets_Subject_On_Subject_Property() { // Arrange var expected = new ContentResult(); // Act var sut = new CreatedResultAssertions(expected); // Assert sut.Subject.Should().Be(expected); }
public void WithContent_Does_Not_Throw_When_Expected_Match() { // Arrange var target = CreateWithJsonContent("FOO"); var sut = new CreatedResultAssertions(target); // Act & Assert sut.Invoking(x => x.WithContent("FOO")) .Should() .NotThrow(); }
public void WithContent_Throws_When_Content_Is_Not_Equivalent_To_Expected_WithBecauseMessage() { // Arrange var target = CreateWithJsonContent("FOO"); var sut = new CreatedResultAssertions(target); // Act & Assert sut.Invoking(x => x.WithContent("BAR", "Because of something")) .Should() .Throw <XunitException>() .WithMessage(@"Expected content of created result to be ""BAR"" Because of something, but ""FOO"" differs near ""FOO"" (index 0)."); }
public void WithContent_Throws_When_ContentTypes_Isnt_Json() { // Arrange var target = new ContentResult { Content = "FOO", ContentType = "BAZ", }; var sut = new CreatedResultAssertions(target); // Act & Assert sut.Invoking(x => x.WithContent("FOO")) .Should() .Throw <XunitException>() .WithMessage(@"Expected content type of created result to be ""application/json"", but found ""BAZ""."); }