Example #1
0
        public static void Hashcode_Differs_for_Object_with_Differing_Angles()
        {
            double        angleRadians1 = 5.3;
            double        angleRadians2 = -2;
            double        tolerance     = 0.0002;
            AngularOffset offset1       = new AngularOffset(new Angle(), new Angle(angleRadians1), tolerance);

            AngularOffset offset2 = new AngularOffset(new Angle(), new Angle(angleRadians2), tolerance);

            Assert.AreNotEqual(offset1.GetHashCode(), offset2.GetHashCode());

            offset2 = new AngularOffset(new Angle(), new Angle(angleRadians1), 2 * tolerance);
            Assert.AreEqual(offset1.GetHashCode(), offset2.GetHashCode());
        }
Example #2
0
        public static void Hashcode_Matches_for_Object_with_Identical_Angles()
        {
            double        angleRadians = 5.3;
            double        tolerance    = 0.0002;
            AngularOffset offset1      = new AngularOffset(new Angle(), new Angle(angleRadians), tolerance);
            AngularOffset offset2      = new AngularOffset(new Angle(), new Angle(angleRadians), tolerance);

            Assert.AreEqual(offset1.GetHashCode(), offset2.GetHashCode());
        }