Example #1
0
        public void TriangleRightTest()
        {
            // arrange



            // act
            Triangle triangle = new ShapeArea.Triangle(12, 5, 13);



            // assert
            Assert.AreEqual(true, triangle.IsRight());
        }
Example #2
0
        public void ZeroTriangleSidesTest()
        {
            // arrange



            // act
            Triangle triangle = new ShapeArea.Triangle();



            // assert
            Assert.AreEqual(0, triangle.Area);
        }
Example #3
0
        public void TriangleAreaTest()
        {
            // arrange
            int a, b, c;

            a = b = c = 5;


            double p = (a + b + c) / 2;

            double result = Math.Sqrt(p * (p - a) * (p - b) * (p - c));


            // act
            Triangle triangle = new ShapeArea.Triangle(a, b, c);



            // assert
            Assert.AreEqual(result, triangle.Area);
        }
Example #4
0
 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();
     }
 }