Open codito opened 6 years ago
This is a great issue. If this functionality gets added, then great. But I think we should also consider using Fluent Assertions.
I used your example and Fluent Assertions for the asserts.
actual.Should().BeEquivalentTo(expected);
This passes, because it does not care about ordering.
If I do actual.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering());
, then the test output is
Message: Expected item[1] to be a collection with 3 item(s)Expected item[1] to be 3, but found 2. Expected item[2] to be a collection with 3 item(s)Expected item[2] to be 2, but found 3.
Admittedly, that message has unnecessary and redundant information
Expected item[1] to be a collection with 3 item(s) Expected item[2] to be a collection with 3 item(s)
I'll have to open an issue, because the previous version of Fluent Assertions did not include that cruft.
Description
Default
Assert
methods should provide information in case of failures. They should at least answer the next question for a developer once a failure occurs. I've seen such behavior withCollectionAsserts
, request to review other APIs as well.Steps to reproduce
List<int>
variables.var actual = { 1, 2, 3 }
andexpected = { 1, 3, 2 }
CollectionAssert.AreEqual(expected, actual)
Expected behavior
A developer would immediately ask what were the elements if the collection doesn't match. Note the
**additional**
information below.Actual behavior
Environment
MSTest 1.2.0, VSTest 15.3.0, dotnet-sdk 2.0 (linux)
AB#2112230