public void DataStructuresGetArea() { DataStructures.Rectangle rect = new DataStructures.Rectangle { X = 3, Y = 4 }; Assert.AreEqual(12, DataStructures.ShapeHelper.GetArea(rect)); DataStructures.Square sqr = new DataStructures.Square { Width = 5 }; Assert.AreEqual(25, DataStructures.ShapeHelper.GetArea(sqr)); DataStructures.Triangle tri = new DataStructures.Triangle { X = 3, Y = 4 }; Assert.AreEqual(6, DataStructures.ShapeHelper.GetArea(tri)); }
private static double GetRectangleArea(Rectangle rect) { return rect.X * rect.Y; }