public static void Hashcode_Differs_for_Object_with_Differing_MaxMin_Coordinates() { CartesianCoordinate coordinate1 = new CartesianCoordinate(1, 2); CartesianCoordinate coordinate2 = new CartesianCoordinate(3, 4); double tolerance = 0.0002; CartesianOffset offset1 = new CartesianOffset(coordinate1, coordinate2, tolerance); CartesianOffset offset2 = new CartesianOffset(2 * coordinate1, coordinate2, tolerance); Assert.AreNotEqual(offset1.GetHashCode(), offset2.GetHashCode()); offset2 = new CartesianOffset(coordinate1, 2 * coordinate2, tolerance); Assert.AreNotEqual(offset1.GetHashCode(), offset2.GetHashCode()); offset2 = new CartesianOffset(coordinate1, coordinate2, 2 * tolerance); Assert.AreEqual(offset1.GetHashCode(), offset2.GetHashCode()); }
public static void Hashcode_Matches_for_Object_with_Identical_Coordinates() { CartesianCoordinate coordinate1 = new CartesianCoordinate(1, 2); CartesianCoordinate coordinate2 = new CartesianCoordinate(3, 4); double tolerance = 0.0002; CartesianOffset offset1 = new CartesianOffset(coordinate1, coordinate2, tolerance); CartesianOffset offset2 = new CartesianOffset(coordinate1, coordinate2, tolerance); Assert.AreEqual(offset1.GetHashCode(), offset2.GetHashCode()); }