public void GetHashCodeReturnsDifferentHashCodesForDifferentPaths() { var instance1 = new InstanceFile("1"); var instance2 = new InstanceFile("2"); Assert.False(object.Equals(instance1, instance2)); var firstInstanceHash = instance1.GetHashCode(); var secondInstanceHash = instance2.GetHashCode(); Assert.True( firstInstanceHash != secondInstanceHash, $"Instances {instance1} and {instance2} are not equal, but have equal hashes {firstInstanceHash} and {secondInstanceHash}."); }
public void GetHashCodeReturnsSameHashCodesForEqualPaths() { string path = "test"; var instance1 = new InstanceFile(path); var instance2 = new InstanceFile(path); Assert.True(object.Equals(instance1, instance2)); var firstInstanceHash = instance1.GetHashCode(); var secondInstanceHash = instance2.GetHashCode(); Assert.True( firstInstanceHash == secondInstanceHash, $"Instances {instance1} and {instance2} are equal, but have different hashes {firstInstanceHash} and {secondInstanceHash}."); }