How to check a list is ordered using Fluent Assertions
It is possible to pass the options like:
listFromApi.Should().BeEquivalentTo(sortedList, opt => opt.WithStrictOrdering());
Yes. You can use BeInAscendingOrder
with a lambda.
listFromApi.Should().BeInAscendingOrder(x => x.Property);
For extra clarity at the expense of performance, you can also assert on content equivalence:
listFromApi.Should().BeEquivalentTo(listOfObjects)
.And.BeInAscendingOrder(x => x.Property);