fluentassertions.analyzers
fluentassertions.analyzers copied to clipboard
Missing negation when transforming OnlyContain
When applying the codefix for CollectionShouldNotContainProperty
, the comparison inside the lambda should also be negated.
actual.Should().OnlyContain(x => x.OtherProperty == expectedValue); // before
actual.Should().NotContain(x => x.OtherProperty == expectedValue); // after
Here's how others are negating expressions: https://github.com/JosefPihrt/Roslynator/blob/9098bd81a98e5b57ce65546628cb8d8349ca888f/source/Core/CSharp/Helpers/LogicalNegationHelper.cs