fluentassertions / fluentassertions/fluentassertions.analyzers

Missing negation when transforming OnlyContain

Open
#2 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
131
Forks
25
PR merge metrics
No merged PRs in 30d

Description

When applying the codefix for `CollectionShouldNotContainProperty`, the comparison inside the lambda should also be negated.

```c#
actual.Should().OnlyContain(x => x.OtherProperty == expectedValue); // before
actual.Should().NotContain(x => x.OtherProperty == expectedValue); // after
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the codefix for CollectionShouldNotContainProperty and inspect how it transforms OnlyContain. Reproduce the before/after example, then verify the generated assertion uses NotContain and negates the lambda comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.