Ejemplo n.º 1
0
        public static void EqualsOverride_Is_True_for_Object_with_Identical_Angles()
        {
            double        angleRadians = Numbers.PiOver4;
            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.IsTrue(offset1.Equals(offset2));
            Assert.IsTrue(offset1.Equals((object)offset2));
            Assert.IsTrue(offset1 == offset2);
            Assert.IsTrue(offset1 == angleRadians);
            Assert.IsTrue(angleRadians == offset1);
        }
Ejemplo n.º 2
0
        public static void EqualsOverride_Is_False_for_Object_with_Differing_Angles()
        {
            double        angleRadians = Numbers.PiOver4;
            double        tolerance    = 0.0002;
            AngularOffset offset       = new AngularOffset(new Angle(), new Angle(angleRadians), tolerance);
            AngularOffset offsetDiff   = new AngularOffset(new Angle(), new Angle(Numbers.PiOver2), tolerance);

            Assert.IsFalse(offset == offsetDiff);

            AngularOffset offsetDiffT = new AngularOffset(new Angle(), new Angle(angleRadians), 0.001);

            Assert.IsTrue(offset == offsetDiffT);

            object obj = new object();

            Assert.IsFalse(offset.Equals(obj));
        }