public void GetPerimeter_ReciveNullObjectTest()
        {
            GeometricThing empty    = null;
            var            actual   = geoCal.GetPerimeter(empty);
            const float    expected = 0;

            Assert.AreEqual(expected, actual, 0.0001);
        }
        public void GetPerimeter_SumArrayTest(float[] arr, float expected)
        {
            var geoThings = new GeometricThing[] {
                new Rectangle(arr[0], arr[1]),
                new Triangle(arr[2], arr[3]),
                new Circle(arr[4]),
                new Square(arr[5])
            };
            var actual = geoCal.GetPerimeter(geoThings);

            Assert.AreEqual(expected, actual, 0.0001);
        }
        public void GetPerimeterTest()
        {
            var objectArray = new GeometricThing[]
            {
                new Circle(12),
                new Triangle(2, 2),
                new Square(5)
            };

            var geomatricCalculator = new GeometricCalculator();

            Assert.AreEqual(101, MathF.Round(geomatricCalculator.GetPerimeter(objectArray)));
        }
Example #4
0
 /// <summary>
 /// Gets the area of the object
 /// </summary>
 /// <returns>The area</returns>
 public float GetArea(GeometricThing shape)
 {
     return(shape.GetPerimeter());
 }