fluentassertions.analyzers icon indicating copy to clipboard operation
fluentassertions.analyzers copied to clipboard

Missing negation when transforming OnlyContain

Open jnyrup opened this issue 6 years ago • 1 comments

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

jnyrup avatar Oct 13 '17 19:10 jnyrup

Here's how others are negating expressions: https://github.com/JosefPihrt/Roslynator/blob/9098bd81a98e5b57ce65546628cb8d8349ca888f/source/Core/CSharp/Helpers/LogicalNegationHelper.cs

jnyrup avatar Oct 14 '17 08:10 jnyrup