public void Equality(Ray2D ray1, Ray2D ray2, bool expectedToBeEqual) { Assert.IsTrue(Equals(ray1, ray2) == expectedToBeEqual); Assert.IsTrue(ray1 == ray2 == expectedToBeEqual); Assert.IsFalse(ray1 == ray2 != expectedToBeEqual); Assert.IsTrue(ray1.Equals(ray2) == expectedToBeEqual); if (expectedToBeEqual) { Assert.AreEqual(ray1.GetHashCode(), ray2.GetHashCode()); } }
public void HashCode(Ray2D ray1, Ray2D ray2, bool expectedThatHashCodesAreEqual) { var hashCode1 = ray1.GetHashCode(); var hashCode2 = ray2.GetHashCode(); if (expectedThatHashCodesAreEqual) { Assert.AreEqual(hashCode1, hashCode2); } else { Assert.AreNotEqual(hashCode1, hashCode2); } }