public static void EqualsOverride_Is_True_for_Object_with_Identical_Coordinates() { PolarCoordinate coordinate1 = new PolarCoordinate(1, 2); PolarCoordinate coordinate2 = new PolarCoordinate(3, 4); PolarOffset offset1 = new PolarOffset(coordinate1, coordinate2); PolarOffset offset2 = new PolarOffset(coordinate1, coordinate2); Assert.IsTrue(offset1.Equals(offset2)); Assert.IsTrue(offset1.Equals((object)offset2)); Assert.IsTrue(offset1 == offset2); }
public static void EqualsOverride_Is_False_for_Object_with_Differing_MaxMin_Coordinates() { PolarCoordinate coordinate1 = new PolarCoordinate(1, 2); PolarCoordinate coordinate2 = new PolarCoordinate(3, 4); PolarCoordinate coordinate3 = new PolarCoordinate(3, 4); PolarOffset offset1 = new PolarOffset(coordinate1, coordinate2); PolarOffset offsetDiffI = new PolarOffset(coordinate3, coordinate2); Assert.IsFalse(offset1 == offsetDiffI); PolarCoordinate coordinate4 = new PolarCoordinate(3, 5); PolarOffset offsetDiffJ = new PolarOffset(coordinate1, coordinate4); Assert.IsFalse(offset1 == offsetDiffJ); PolarOffset offsetDiffT = new PolarOffset(coordinate1, coordinate2, 0.001); Assert.IsTrue(offset1 == offsetDiffT); object obj = new object(); Assert.IsFalse(offset1.Equals(obj)); }