public void Ctor_Sets_Subject_On_Subject_Property()
        {
            // Arrange
            var expected = new ContentResult();

            // Act
            var sut = new BadRequestResultAssertions(expected);

            // Assert
            sut.Subject.Should().Be(expected);
        }
        public void WithErrorMessage_Does_Not_Throw_When_Expected_Match(object content)
        {
            // Arrange
            var target = CreateWithJsonContent(content);
            var sut    = new BadRequestResultAssertions(target);

            // Act & Assert
            sut.Invoking(x => x.WithErrorMessage("FOO"))
            .Should()
            .NotThrow();
        }
        public void WithErrorMessage_Throws_When_Content_Doenst_Match_Expected(object content)
        {
            // Arrange
            var target = CreateWithJsonContent(content);
            var sut    = new BadRequestResultAssertions(target);

            // Act & Assert
            sut.Invoking(x => x.WithErrorMessage("BAR"))
            .Should()
            .Throw <XunitException>()
            .WithMessage(@"Expected error message of bad request result to be ""BAR"", but found ""FOO"".");
        }
        public void WithContent_Throws_When_Content_Is_Not_Equivalent_To_Expected_WithBecauseMessage()
        {
            // Arrange
            var target = CreateWithJsonContent("FOO");

            var sut = new BadRequestResultAssertions(target);

            // Act & Assert
            sut.Invoking(x => x.WithContent("BAR", "Because of something"))
            .Should()
            .Throw <XunitException>()
            .WithMessage(@"Expected content of bad request 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 BadRequestResultAssertions(target);

            // Act & Assert
            sut.Invoking(x => x.WithContent("FOO"))
            .Should()
            .Throw <XunitException>()
            .WithMessage(@"Expected content type of bad request result to be ""application/json"", but found ""BAZ"".");
        }