示例#1
0
        public void ZeroCircleRadiusTest()
        {
            // arrange



            // act
            Circle circle = new ShapeArea.Circle();



            // assert
            Assert.AreEqual(0, circle.Area);
        }
示例#2
0
        public void CircleAreaTest()
        {
            // arrange
            double rightArea = Math.PI * Math.Pow(5, 2);


            // act
            Circle circle = new ShapeArea.Circle(5);



            // assert
            Assert.AreEqual(rightArea, circle.Area);
        }
示例#3
0
文件: Shape.cs 项目: mr-fool/CSharp
 static void Main(string[] args)
 {
     Console.WriteLine("Please enter the shape type");
     string type = Convert.ToString(Console.ReadLine());
     if (type.ToLower().Equals("rectangle")){
         Rectange Rect = new Rectange();
         Console.WriteLine("Please enter the width");
         Rect.setWidth(Convert.ToInt32(Console.ReadLine()));
         Console.WriteLine("Please enter the height");
         Rect.setHeight(Convert.ToInt32(Console.ReadLine()));
         Console.WriteLine("Total area: {0}", Rect.getArea());
         Console.ReadKey();
     }
     if (type.ToLower().Equals("triangle"))
     {
         Triangle Tri = new Triangle();
         Console.WriteLine("Please enter the width");
         Tri.setWidth(Convert.ToInt32(Console.ReadLine()));
         Console.WriteLine("Please enter the height");
         Tri.setHeight(Convert.ToInt32(Console.ReadLine()));
         Console.WriteLine("Total area: {0}", Tri.getArea());
         Console.ReadKey();
     }
     if (type.ToLower().Equals("circle"))
     {
         Circle Cir = new Circle();
         Console.WriteLine("Please enter the radius");
         Cir.setRadius(Convert.ToInt32(Console.ReadLine()));
         Console.WriteLine("Total area: {0}", Cir.getArea());
         Console.ReadKey();
     }
 }