Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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");
 }