C#: How would you unit test GetHashCode?

Test that two distinct objects which are equal have the same hash code (for various values). Check that non-equal objects give different hash codes, varying one aspect/property at a time. While the hash codes don’t have to be different, you’d be really unlucky to pick different values for properties which happen to give the same hash code unless you’ve got a bug.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)