public void EqualsTests(ISort <SuperHero> first, object second, bool expected, string reason) { _outputHelper.WriteLine($"{nameof(first)} : '{first}'"); _outputHelper.WriteLine($"{nameof(second)} : '{second}'"); // Act bool actual = first.Equals(second); int actualHashCode = first.GetHashCode(); // Assert actual.Should() .Be(expected, reason); if (actual) { actualHashCode.Should() .Be(second?.GetHashCode(), reason); } else { actualHashCode.Should() .NotBe(second?.GetHashCode(), reason); } }