Esempio n. 1
0
        public void TestSame()
        {
            Vector3     foo    = new Vector3(1.0, 2.0, 4.5);
            Vector3     bar    = new Vector3(1.0, 2.0, 4.5);
            IDifference result = Point3DDifference.Construct("Foo", foo, bar);

            Assert.IsNull(result);
        }
Esempio n. 2
0
        public void TestToString()
        {
            Vector3     bar        = new Vector3(1.0, 5.0, 8.3);
            IDifference result     = Point3DDifference.Construct("Foo", null, bar);
            string      diffString = result.ToString();

            Assert.IsNotNull(diffString);
            AssertOneLiner(diffString);
        }
Esempio n. 3
0
        public void TestOneNull()
        {
            Vector3     bar    = new Vector3(1.0, 5.0, 8.3);
            IDifference result = Point3DDifference.Construct("Foo", null, bar);

            Assert.IsNotNull(result);

            result = Point3DDifference.Construct("Foo", bar, null);
            Assert.IsNotNull(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Constructs a new <see cref="IDifference"/> object.
        /// </summary>
        /// <param name="name">a name reflecting the nature of the created <see cref="IDifference"/></param>
        /// <param name="first">the first object to compare</param>
        /// <param name="second">the second object to compare</param>
        /// <returns>an <see cref="IDifference"/> reflecting the differences between the first and second object</returns>
        public static IDifference Construct(string name, Vector3?first, Vector3?second)
        {
            if (first == null && second == null)
            {
                return(null);
            }

            var totalDiff = new Point3DDifference(name);

            totalDiff.AddChild(DoubleDifference.Construct("x", first.HasValue ? (double?)null : first.Value.X, second.HasValue ? (double?)null : second.Value.X));
            totalDiff.AddChild(DoubleDifference.Construct("y", first.HasValue ? (double?)null : first.Value.Y, second.HasValue ? (double?)null : second.Value.Y));
            totalDiff.AddChild(DoubleDifference.Construct("z", first.HasValue ? (double?)null : first.Value.Z, second.HasValue ? (double?)null : second.Value.Z));
            if (totalDiff.ChildCount() == 0)
            {
                return(null);
            }
            return(totalDiff);
        }
Esempio n. 5
0
        public void TestTwoNull()
        {
            IDifference result = Point3DDifference.Construct("Foo", null, null);

            Assert.IsNull(result);
        }