Description
The ordering assertions in CollectionAssertions expect an IComparer<object>, although the declared type of the items in the collection does not need to be object. This makes it hard to use standard comparers such as StringComparer and comparers derived from Comparer<T>.
Complete minimal example reproducing the issue
The following does not compile:
string[] actual = { "a", "b", "c" };
actual.Should().BeInAscendingOrder(StringComparer.CurrentCultureIgnoreCase);
Expected behavior:
- You should be able to use a comparer that implements
IComparer<T> for a generic collection with items of type T.
- You should be able to use a comparer that implements
IComparer for a non-generic collection.
Actual behavior:
Does not compile.
Versions
- Which version of Fluent Assertions are you using? v5.6.0
- Which .NET runtime and version are you targeting? .NET framework 4.6.1