public void GetTriangleArea() { var triangleObj = new Triangle(); triangleObj.MainSide = 1; triangleObj.SideB = 2; triangleObj.SideC = 2; var triangle = new AreaCalculator(triangleObj); var expected = 0.97; var result = triangle.GetTriangleArea(); Assert.Equal(expected, result); }
public double GetShape(IShape shape) { if (shape is Circle) { AreaCalculator areaCalculator = new AreaCalculator((Circle)shape); var areaOfCircle = areaCalculator.GetCircleArea(); return(areaOfCircle); } else { AreaCalculator areaCalculator = new AreaCalculator((Triangle)shape); var areaOfTriangle = areaCalculator.GetTriangleArea(); return(areaOfTriangle); } }