Пример #1
0
        public static void EqualsOverride_Is_True_for_Object_with_Identical_Coordinates()
        {
            CartesianCoordinate coordinate1 = new CartesianCoordinate(1, 2);
            CartesianCoordinate coordinate2 = new CartesianCoordinate(3, 4);
            CartesianOffset     offset1     = new CartesianOffset(coordinate1, coordinate2);
            CartesianOffset     offset2     = new CartesianOffset(coordinate1, coordinate2);

            Assert.IsTrue(offset1.Equals(offset2));
            Assert.IsTrue(offset1.Equals((object)offset2));
            Assert.IsTrue(offset1 == offset2);
        }
Пример #2
0
        public static void EqualsOverride_Is_False_for_Object_with_Differing_MaxMin_Coordinates()
        {
            CartesianCoordinate coordinate1 = new CartesianCoordinate(1, 2);
            CartesianCoordinate coordinate2 = new CartesianCoordinate(3, 4);
            CartesianCoordinate coordinate3 = new CartesianCoordinate(3, 4);
            CartesianOffset     offset1     = new CartesianOffset(coordinate1, coordinate2);
            CartesianOffset     offsetDiffI = new CartesianOffset(coordinate3, coordinate2);

            Assert.IsFalse(offset1 == offsetDiffI);

            CartesianCoordinate coordinate4 = new CartesianCoordinate(3, 5);
            CartesianOffset     offsetDiffJ = new CartesianOffset(coordinate1, coordinate4);

            Assert.IsFalse(offset1 == offsetDiffJ);

            CartesianOffset offsetDiffT = new CartesianOffset(coordinate1, coordinate2, 0.001);

            Assert.IsTrue(offset1 == offsetDiffT);

            object obj = new object();

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