Skip to content

Should().AllBeEquivalentTo does not work on List<String> #1263

@michaelveloz

Description

@michaelveloz

Should().AllBeEquivalentTo works for Lists of various types, but appears not to work for List<String>, in version 5.10.2

This is very easy to reproduce. In a new Net Framekwork 4.7.2 app, add these two lines of code to any event handler:

new List<int> { 1, 2, 3 }.Should().AllBeEquivalentTo(new List<int> { 1, 2, 3 });
new List<String> { "a", "b", "c" }.Should().AllBeEquivalentTo(new List<String> { "foo", "bar" });

The first line generates no errors, the second line generates 'StringCollectionAssertions' does not contain a definition for 'AllBeEquivalentTo' and no accessible extension method 'AllBeEquivalentTo' accepting a first argument of type 'StringCollectionAssertions' could be found (are you missing a using directive or an assembly reference?)

It seems like I must be missing something very obvious, but the documentation does not say that there are special requirements for List<String>

I see that in the case of List<int> GenericCollectionAssertions is providing the assertion, but the error for List<string> implies that the reference is trying to be resolved against StringCollectionAssertions - is this a separate module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions