Skip to content

Commit

Permalink
Merge pull request #2036 from jnyrup/Equatable_fix
Browse files Browse the repository at this point in the history
Let `EquatableOfInt` implement `IComparable<T>`
  • Loading branch information
jnyrup committed Nov 20, 2022
2 parents 1eb182a + 48fc0bc commit ee00f8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tests/FluentAssertions.Specs/Numeric/ComparableSpecs.cs
Expand Up @@ -642,7 +642,7 @@ public override int GetHashCode()
}
}

public class EquatableOfInt
public class EquatableOfInt : IComparable<EquatableOfInt>
{
public int Value { get; set; }

Expand All @@ -665,6 +665,9 @@ public override string ToString()
{
return Value.ToString(CultureInfo.InvariantCulture);
}

int IComparable<EquatableOfInt>.CompareTo(EquatableOfInt other) =>
throw new NotSupportedException("This type is meant for assertions using Equals()");
}

public class ComparableOfInt : IComparable<ComparableOfInt>
Expand Down

0 comments on commit ee00f8f

Please sign in to comment.