static ShapeAbstract shapeAbs; //null static void AbstractExample() { Console.WriteLine("1 for Rectangle\n2 for Square"); var choice = Console.ReadLine(); switch (choice) { case "1": shapeAbs = new RectangleAbstract(); break; case "2": shapeAbs = new SquareAbstract(); break; case "3": //shape = new Circle(); break; default: break; } shapeAbs.DisplayIntro(); shapeAbs.GetInput(); shapeAbs.DisplayArea(); shapeAbs.DisplayPerimeter(); }
public void ShouldCalculateAreaForCircleAndSquare() { var shapes = new ShapeAbstract[] { new SquareAbstract(2F), new CircleAbstract(2F) }; var area = new AreaCalculatorAbstract(shapes) .Sum(); Assert.AreEqual(area, 16.566371f); }