Skip to content

Commit

Permalink
Add equatable overload
Browse files Browse the repository at this point in the history
Works around shouldly/shouldly#825.
  • Loading branch information
rainersigwald committed May 1, 2023
1 parent b20afac commit afa0b76
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private static CopyOnWritePropertyDictionary<MockValue> CreateInstance(params st
return dic;
}

private sealed class MockValue : IKeyed, IValued, IEquatable<MockValue>, IImmutable
private sealed class MockValue : IKeyed, IValued, IEquatable<MockValue>, IEquatable<object>, IImmutable
{
public MockValue(string s) => Key = s;

Expand All @@ -210,6 +210,15 @@ public bool Equals(MockValue? other)
{
return other != null && Key == other.Key;
}

public new bool Equals(object? other)
{
if (other is MockValue mv)
{
return Equals(mv);
}
return false;
}
}
}
}

0 comments on commit afa0b76

Please sign in to comment.