public void PentagonAreaTest() { double a = 1; double expetedArea = 1.7205; Pentagon p = new Pentagon(a); double actualArea = p.GetArea(); Assert.AreEqual(expetedArea, actualArea, 0.0001); }
static void Main(string[] args) { Polygon polygon = new Pentagon(0, 0, 2, 0, 2, 2, 1, 3, 0, 2); polygon.Show(); Console.Write(polygon.GetArea()); polygon = new Rectangle(0, 0, 4, 6); polygon.Show(); Console.Write(polygon.GetArea()); polygon = new Square(0, 0, 4, 4); polygon.Show(); Console.Write(polygon.GetArea()); }