Пример #1
0
        public void CheckDescriptionOfTriangle()
        {
            ConvexShape triangle = new ConvexShape();

            triangle.SetPointCount(3);
            triangle.SetPoint(0, new Vector2f(40, 60));
            triangle.SetPoint(1, new Vector2f(100, 100));
            triangle.SetPoint(2, new Vector2f(200, 350));

            ShapeDecorator circleDecorator = new TriangleDecorator(triangle);

            string expected = "Triangle: P=672,58; S=5500";
            string actual   = circleDecorator.GetDescription();

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void CheckAreaOfTriangle()
        {
            ConvexShape triangle = new ConvexShape();

            triangle.SetPointCount(3);
            triangle.SetPoint(0, new Vector2f(40, 60));
            triangle.SetPoint(1, new Vector2f(100, 100));
            triangle.SetPoint(2, new Vector2f(200, 350));

            ShapeDecorator circleDecorator = new TriangleDecorator(triangle);

            string expected = "5500";
            string actual   = "";

            actual = actual + circleDecorator.GetArea();
            Assert.AreEqual(expected, actual);
        }