コード例 #1
0
        public void AddLinesTest()
        {
            List <Point> a = new List <Point>()
            {
                new Point()
                {
                    X = 0,
                    Y = 0
                },
                new Point()
                {
                    X = 2,
                    Y = 2
                },
                new Point()
                {
                    X = 4,
                    Y = 0
                }
            };
            List <Point> b = new List <Point>()
            {
                new Point()
                {
                    X = 1,
                    Y = 2
                },
                new Point()
                {
                    X = 2,
                    Y = 2
                },
                new Point()
                {
                    X = 3,
                    Y = 2
                }
            };
            List <Point> expectedSum = new List <Point>()
            {
                new Point()
                {
                    X = 1,
                    Y = 3
                },
                new Point()
                {
                    X = 2,
                    Y = 4
                },
                new Point()
                {
                    X = 3,
                    Y = 3
                }
            };
            List <Point> sum = LineAdder.AddLines(a, b);

            CollectionAssert.AreEqual(expectedSum, sum);
        }
コード例 #2
0
        public void MiddleValueTest()
        {
            double y = LineAdder.MiddleValue(
                new Point()
            {
                X = 0,
                Y = 0
            },
                new Point()
            {
                X = 4,
                Y = 4
            },
                2);

            Assert.AreEqual(2, y);
        }