public void TestSquareTrinangleArgumentExc() // недостаточно аргументов { ShapeCreator tc = new TriangleCreator(); Shape actual; Assert.Throws <ArgumentException>(() => actual = tc.Create(4, 3)); }
public void TestSquareTrinangleSignedSide() // отрицательная сторона { ShapeCreator tc = new TriangleCreator(); Shape actual; Assert.Throws <ArgumentException>(() => actual = tc.Create(-5, 4, 3)); }
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); }
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"); } }