コード例 #1
0
        public void AssertBaseOnTriangleIsFound3()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            Point[] p = new Point[3];

            Point[] actual = new Point[2];
            Point[] expected = new Point[2];

            p[2].X = 30;
            p[2].Y = 30;

            p[1].X = 84;
            p[1].Y = 30;

            p[0].X = 57;
            p[0].Y = 76;

            expected[0] = p[1];
            expected[1] = p[2];

            actual = cg.FindBasePoints(p);
            Boolean result = CheckPointsArray(expected, actual);

            Assert.IsTrue(result, "Triangle base points are not the same");
        }
コード例 #2
0
        public void AssertConstantIsCorrectResult()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            decimal expected = -5;
            decimal actual = cg.FindConstrantFromEquationOfLine(3, 4, 3);

            Assert.AreEqual(expected, actual, "Values are not equal");
        }
コード例 #3
0
        public void AssertYValueIsIncorrectResult()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            int expected = 5;
            decimal actual = cg.FindYValueFromEquationOfLine(4, 3, -6);

            Assert.AreNotEqual(expected, (int)actual, "Values are not equal");
        }
コード例 #4
0
        public void AssertXValueIsCorrectResult()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            int expected = 0;
            decimal actual = cg.FindXValueFromEquationOfLine(5, 3, 4);

            Assert.AreEqual(expected, (int)actual, "Values are not equal");
        }
コード例 #5
0
        public void AssertTopOfTriangleIsFound3()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            Point[] p = new Point[3];

            Point actual = new Point();
            Point expected = new Point();

            p[2].X = 30;
            p[2].Y = 30;

            p[1].X = 84;
            p[1].Y = 30;

            p[0].X = 57;
            p[0].Y = 76;

            expected = p[0];
            actual = cg.FindTopPoint(p);

            Assert.AreEqual(expected, actual, "Triangle top point is wrong");
        }
コード例 #6
0
        public void AssertPythagorasReturnsIncorrectResult()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            double expected = 40;
            int actual = cg.Pythagoras(50, 26);

            Assert.AreNotEqual((int)expected, actual, "The values are not equal");
        }
コード例 #7
0
        public void AssertGradientOfLineReturnsIncorrectResult()
        {
            CoordinateGeometry cg = new CoordinateGeometry();

            Point[] point = new Point[2];

            point[0].X = 45;
            point[0].Y = 55;

            point[1].X = 37;
            point[1].Y = 33;

            decimal expected = 1M / 1;
            decimal actual = cg.GradientOfLine(point);

            Assert.AreNotEqual(expected, actual, "Values are not equal");
        }