Should().AllBeEquivalentTo does not work on List<String>
See original GitHub issueShould().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?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
@dennisdoomen, I’ve pushed changes where this method is renamed to
AllBe
.I think that string collections should also support this functionality, so I’ve provided a PR to add it. @jnyrup, @dennisdoomen I would be glad if you take a look at it.