Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thomhurst committed Jan 26, 2025
1 parent 21d29f4 commit 3e17d80
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Text;
using TUnit.Assertions.Enums;
using TUnit.Assertions.Equality;
using TUnit.Assertions.Extensions;
Expand Down Expand Up @@ -66,6 +65,11 @@ internal class ComparerWrapper<T>(IEqualityComparer<T> equalityComparer) : IComp
{
public int Compare(T? x, T? y)
{
if (equalityComparer is IComparer<T> comparer)
{
return comparer.Compare(x!, y!);
}

if (x is null && y is null)
{
return 0;
Expand All @@ -76,7 +80,12 @@ public int Compare(T? x, T? y)
return -1;
}

return equalityComparer.Equals(x, y) ? 0 : -1;
if (equalityComparer.Equals(x, y))
{
return 0;
}

return Comparer<T>.Default.Compare(x, y);
}
}
}

0 comments on commit 3e17d80

Please sign in to comment.