Esempio n. 1
0
        static void Main(string[] args)
        {
            var rectangulos = new[]
            {
                new Rectangle {
                    Width = 10, Height = 5
                },
                new Rectangle {
                    Width = 4, Height = 6
                },
                new Rectangle {
                    Width = 5, Height = 1
                },
                new Rectangle {
                    Width = 8, Height = 9
                }
            };

            var sumaDeAreas      = AreaOperations.Sum(rectangulos);
            var sumaDePerimetros = PerimeterOperations.Sum(rectangulos);

            Console.WriteLine($"Area total:  {sumaDeAreas}" + $"\n Perimetro Total: {sumaDePerimetros}");

            Console.ReadKey();
        }
Esempio n. 2
0
        public void Sum_Perimeters()
        {
            var rectangles = Shapes;

            double actual = PerimeterOperations.Sum(rectangles);

            Assert.AreEqual(expectedPerimeter, actual);
        }
        public void Calculate(IEnumerable <IGeometricShape> figuras)
        {
            var areaOperations      = new AreaOperations();
            var perimeterOperations = new PerimeterOperations();

            TotalAreas      = areaOperations.Sum(figuras);
            TotalPerimeters = perimeterOperations.Sum(figuras);
        }
Esempio n. 4
0
        public void Single_Responsability_Principle_Violation()
        {
            var rectangles = new[]
            {
                new Rectangle {
                    Width = 10, Height = 5
                },
                new Rectangle {
                    Width = 4, Height = 6
                },
                new Rectangle {
                    Width = 5, Height = 1
                },
                new Rectangle {
                    Width = 8, Height = 9
                }
            };

            var sumAreas     = new AreaOperations().Sum(rectangles);
            var sumPerimetro = new PerimeterOperations().Sum(rectangles);
        }
Esempio n. 5
0
 public void Calculate(IEnumerable <IGeometricShape> shapes)
 {
     TotalAreas      = AreaOperations.Sum(shapes);
     TotalPerimeters = PerimeterOperations.Sum(shapes);
 }