public void TestCircleWithRadius() { targetRadius = 3; Circle c = new Circle("BlueEyedBoy", "blue", targetRadius); double expectedArea = targetRadius * targetRadius * Math.PI; double actualArea = c.Area(); Assert.IsTrue(actualArea.CompareTo(expectedArea) == 0, "Area of circle expected to be {0} but was not[{1}].", expectedArea, actualArea); }
public void TestCircleWithPropertySetRadius() { targetRadius = 42; Circle c = new Circle("CodeRed", "red", 5); c.Radius = targetRadius; double expectedArea = targetRadius * targetRadius * Math.PI; double actualArea = c.Area(); Assert.IsTrue(Math.Round(expectedArea, 3) == Math.Round(actualArea, 3), "Area of circle expected to be {0} but was not[{1}].", expectedArea, actualArea); }
public void TestCircleNoRadius() { Circle c = new Circle("Greeny", "green"); Assert.IsTrue(c.Area() == 0.0, "Area of circle expected to be zero with no radius set"); }