Skip to content

Commit

Permalink
Fix CollectionAssert.AreEqual for collection of collections ignores e…
Browse files Browse the repository at this point in the history
…ven-items (#3893)
  • Loading branch information
engyebrahim authored and Evangelink committed Sep 30, 2024
1 parent 5917c99 commit 6d9c5ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ private static bool CompareIEnumerable(IEnumerable? expected, IEnumerable? actua
{
stack.Push(new(expectedEnum, actualEnum, position + 1));
stack.Push(new(curExpectedEnum.GetEnumerator(), curActualEnum.GetEnumerator(), 0));
break;
continue;
}
else if (comparer.Compare(curExpected, curActual) != 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ public void CollectionAssertAreEqual_WithIgnoreCaseComparer_DoesNotThrow()
CollectionAssert.AreEqual(expected, actual, StringComparer.OrdinalIgnoreCase);
}

public void CollectionAssertAreEqual_WithNestedDiffSizedArrays_Fails()
{
int[][] expected = [[1, 2], [3, 4], [5, 6], [7, 8], [9]];
int[][] actual = [[1, 2], [999, 999, 999, 999, 999], [5, 6], [], [9]];
VerifyThrows(() => CollectionAssert.AreEqual(expected, actual));
}

public void CollectionAssertAreEqual_WithCaseSensetiveComparer_Fails()
{
List<string> expected = ["one", "two"];
Expand Down

0 comments on commit 6d9c5ea

Please sign in to comment.