Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Group          group = new GroupSum();
            FigureCircle   fc    = new FigureCircle(1);
            FigureSquare   fs    = new FigureSquare(3);
            FigureTriangle ft    = new FigureTriangle(3, 4, 5);

            Group gr = new GroupSum();

            gr.Add(fs);

            Console.WriteLine(fc.Measure());
            Console.WriteLine(fs.Measure());
            Console.WriteLine(ft.Measure());

            Console.WriteLine(gr.Measure());

            group.Add(fc);
            group.Add(fs);
            group.Add(ft);
            group.Add(gr);


            Console.WriteLine(group.Measure());
        }
Ejemplo n.º 2
0
        public void Measure_Length10()
        {
            float        lenOfSide = 10;
            FigureSquare square    = new FigureSquare(lenOfSide);
            float        S         = MathF.Pow(lenOfSide, 2);

            float measure = square.Measure();

            Assert.AreEqual(S, measure);
        }
Ejemplo n.º 3
0
        public void Measure_SumItems_OnlyFigures()
        {
            FigureSquare square   = new FigureSquare(3);
            FigureCircle circle   = new FigureCircle(3);
            GroupSum     groupSum = new GroupSum();

            groupSum.Add(square);
            groupSum.Add(circle);
            float measureItems = square.Measure() + circle.Measure();
            float measureGroup = groupSum.Measure();

            Assert.AreEqual(measureItems, measureGroup);
        }
Ejemplo n.º 4
0
        public void Measure_MultiplyItems_OnlyFigures()
        {
            FigureSquare  square        = new FigureSquare(3);
            FigureCircle  circle        = new FigureCircle(3);
            GroupMyltiply groupMyltiply = new GroupMyltiply();

            groupMyltiply.Add(square);
            groupMyltiply.Add(circle);
            float measureItems = square.Measure() * circle.Measure();
            float measureGroup = groupMyltiply.Measure();

            Assert.AreEqual(measureItems, measureGroup);
        }