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); }
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()); }
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"); }