You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on discussion topic #4448 there is a problem provided constructive information about failure once comparing two collections. For example:
var actual = new[] { "A", "B", "C" };
var expected = new[] { "C", "B", "A" };
Assert.That(actual, Is.EqualTo(expected));
Failure gives fallowing information: Expected and actual are both <System.String[3]>
Values differ at index [0]
String lengths are both 1. Strings differ at index 0.
Expected: "C"
But was: "A"
-----------^
Unfortunately, this does not show full list of actual and expected values which makes very complex to investigate when order is changed since full list is not provided. As comparison, Comparing of each collection item provides all useful information about both collection:
var actual = new[] { "A", "B", "C" };
Assert.That(actual, Has.All.EqualTo("E"));
Which fails with very useful message: Expected: all items equal to "EX"
But was: < "A", "B", "C" >
First non-matching item at index [0]: "A"
I would expect similar information to be provided by EqualTo once two collections are compared so it lists actual and expected list and would consider truncation for long collection lists. For example in my first case should provide something like this: Expected and actual are both <System.String[3]>
String lengths are both 1. Strings differ at index 0.
Expected: < "C", "B", "A" >"
But was: < "A", "B", "C" >
First non-matching item at index [0]: "A"
The text was updated successfully, but these errors were encountered:
gps7
changed the title
EqualTo comparison provides very wage failure results for collection comparison
Missing comparison failure details for EqualTo when comparing two collection
Aug 31, 2023
Based on discussion topic #4448 there is a problem provided constructive information about failure once comparing two collections. For example:
Failure gives fallowing information:
Expected and actual are both <System.String[3]>
Values differ at index [0]
String lengths are both 1. Strings differ at index 0.
Expected: "C"
But was: "A"
-----------^
Unfortunately, this does not show full list of actual and expected values which makes very complex to investigate when order is changed since full list is not provided. As comparison, Comparing of each collection item provides all useful information about both collection:
Which fails with very useful message:
Expected: all items equal to "EX"
But was: < "A", "B", "C" >
First non-matching item at index [0]: "A"
I would expect similar information to be provided by EqualTo once two collections are compared so it lists actual and expected list and would consider truncation for long collection lists. For example in my first case should provide something like this:
Expected and actual are both <System.String[3]>
String lengths are both 1. Strings differ at index 0.
Expected: < "C", "B", "A" >"
But was: < "A", "B", "C" >
First non-matching item at index [0]: "A"
The text was updated successfully, but these errors were encountered: