Example #1
0
        public void TestMapToFormPointsCorrect()
        {
            var input = new List <Point>
            {
                new Point(1.1, 1.2),
                new Point(2.1, 2.2),
                new Point(3.1, 3.2),
                new Point(4.1, 4.2)
            };
            var expected = new List <Point>
            {
                new Point(1.1, 1.2),
                new Point(1.1, 4.2),
                new Point(4.1, 4.2),
                new Point(4.1, 1.2),
                new Point(1.1, 1.2)
            };
            var rect   = new RectangleFormMapper();
            var output = rect.MapToForm(input)[0];

            Assert.AreEqual(expected.Count, output.Count);
            for (int k = 0; k < expected.Count; k++)
            {
                Assert.AreEqual(expected[k].X, output[k].X);
                Assert.AreEqual(expected[k].Y, output[k].Y);
            }
        }
Example #2
0
        public void TestMapToFormDoubleFails()
        {
            double[] input  = null;
            var      rect   = new RectangleFormMapper();
            var      output = rect.MapToForm(input);

            Assert.IsNull(output);

            input  = new double[0];
            output = rect.MapToForm(input);
            Assert.IsNull(output);

            input  = new [] { 1.1, 1.2, 1.3 };
            output = rect.MapToForm(input);
            Assert.IsNull(output);
        }
Example #3
0
        public void TestMapToFormPointFails()
        {
            List <Point> input  = null;
            var          rect   = new RectangleFormMapper();
            var          output = rect.MapToForm(input);

            Assert.IsNull(output);

            input  = new List <Point>();
            output = rect.MapToForm(input);
            Assert.IsNull(output);

            input = new List <Point>
            {
                new Point(1.1, 1.2)
            };
            output = rect.MapToForm(input);
            Assert.IsNull(output);
        }
Example #4
0
        public void TestMapToFormDoubleCorrect()
        {
            double[] input = { 1.1, 1.2, 2.1, 2.2, 3.1, 3.2, 4.1, 4.2 };

            var expected = new List <double[]> {
                new double[] { 1.1, 1.2, 1.1, 4.2 },
                new double[] { 1.1, 1.2, 4.1, 1.2 },
                new double[] { 1.1, 4.2, 4.1, 4.2 },
                new double[] { 4.1, 1.2, 4.1, 4.2 }
            };
            var rect   = new RectangleFormMapper();
            var output = rect.MapToForm(input);

            Assert.AreEqual(expected.Count, output.Count);
            for (int k = 0; k < expected.Count; k++)
            {
                for (int i = 0; i < expected[k].Length; i++)
                {
                    Assert.AreEqual(expected[k][i], output[k][i]);
                }
            }
        }