public static void GetHashCode___Should_throw_NotSupportedException___When_constructed_with_null_getHashCodeFunc() { // Arrange var systemUnderTest = new LambdaBackedEqualityComparer <string>((x, y) => x.First() == y.First(), getHashCodeFunc: null); // Act var actual = Record.Exception(() => systemUnderTest.GetHashCode("abc")); // Assert actual.Should().BeOfType <NotSupportedException>(); }
public static void GetHashCode___Should_use_getHashCodeFunc___When_called() { // Arrange var hashCode = A.Dummy <int>(); var systemUnderTest = new LambdaBackedEqualityComparer <string>( (x, y) => x.First() == y.First(), obj => hashCode); // Act var actual = systemUnderTest.GetHashCode(A.Dummy <string>()); // Assert actual.Should().Be(hashCode); }