public override int GetHashCode() { unchecked { return((Depth * 397) ^ Position.GetHashCode()); } }
public void Point3Test() { var point3 = new Point3(3d, 3d, 3d); int hashCode = point3.GetHashCode(); Assert.IsTrue(point3.Equals(new Point3(3, 3, 3))); Assert.IsFalse(point3.Equals(3d)); Assert.AreEqual(3, point3.X); Assert.AreEqual(3, point3.Y); Assert.AreEqual(3, point3.Z); }
public void TestEquality() { var p = new Point3(1, 2, 3); var p2 = new Point3(1, 2, 3); Assert.AreEqual(p, p2); Assert.AreEqual(p.GetHashCode(), p2.GetHashCode()); Assert.IsFalse(p.Equals(null)); Assert.IsTrue(p.Equals(p)); Assert.IsFalse(p.Equals(1)); }