Exemple #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);
 }
Exemple #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);
 }
Exemple #3
0
 static void Main(string[] args)
 {
     Console.WriteLine("Code documentation with shapes...");
     Circle c = new Circle("Just A Name", "");
     Console.WriteLine(c.ToString());
     c = new Circle("Greeny", "green");
     Console.WriteLine(c.ToString());
     c = new Circle("Code Red", "red", 5);
     Console.WriteLine(c.ToString());
     c = new Circle("Blue Eyed Boy", "blue", 10, "gold");
     Console.WriteLine(c.ToString());
 }
Exemple #4
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");
 }