Skip to content

Collection: Should().AllBeEquivalentTo() does not ignore case #2064

@konarx

Description

@konarx

Description

When trying to assert a Collection of string with Equivalence (in order to ignore case), these 2 approaches, although they look the same, they differ. In fact, the Should().AllSatisfy(x => x.Should().BeEquivalentTo("this")) PASSES while Should().AllBeEquivalentTo("this") FAILS

Complete minimal example reproducing the issue

[Test]
public void Test_AllBeEquivalent()
{
    List<string> data = new() {"this", "tHis", "This", "THis", "thIS"};

    data.Should().AllSatisfy(x => x.Should().BeEquivalentTo("this")); //PASS

    data.Should().AllBeEquivalentTo("this"); //FAIL
}

Expected behavior:

data.Should().AllBeEquivalentTo("this") should PASS

Actual behavior:

data.Should().AllBeEquivalentTo("this") FAIL

Versions

  • Fluent Assertions 6.8
  • .NET 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationenhancement

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions