コード例 #1
0
        public void TestSquareTrinangleArgumentExc()  // недостаточно аргументов
        {
            ShapeCreator tc = new TriangleCreator();
            Shape        actual;

            Assert.Throws <ArgumentException>(() => actual = tc.Create(4, 3));
        }
コード例 #2
0
        public void TestSquareTrinangleSignedSide() // отрицательная сторона
        {
            ShapeCreator tc = new TriangleCreator();
            Shape        actual;

            Assert.Throws <ArgumentException>(() => actual = tc.Create(-5, 4, 3));
        }
コード例 #3
0
        public void TestSquareTrinangle()
        {
            ShapeCreator tc        = new TriangleCreator();
            var          triangle1 = tc.Create(5, 4, 3);
            double       actual    = triangle1.Square();
            double       expected  = 6;

            Assert.AreEqual(actual, expected);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            ShapeCreator cc      = new CircleCreator();
            var          circle1 = cc.Create(3); // аргумент - радиус
            var          circle2 = cc.Create(5);

            Console.WriteLine(circle1.Square() + " " + circle1.name);

            ShapeCreator tc        = new TriangleCreator();
            var          triangle1 = tc.Create(5, 4, 3); // аргументы - стороны

            Console.WriteLine(triangle1.Square() + " " + triangle1.name);
            if (Triangle.RightAngle((Triangle)triangle1))
            {
                Console.WriteLine("Right");
            }
        }