Esempio n. 1
0
        public void Test_AddFigure(double radius)
        {
            var figure = new SkinCircle(radius);

            _box.AddFigure(figure);

            IFigure result       = _box.Figures[5];
            IFigure actualResult = figure;

            Assert.AreEqual(result, actualResult);
        }
Esempio n. 2
0
        public void AddFigureWhenFigureIsInBoxAddNewFigure()
        {
            var figures = new List <IFigure>
            {
                new RectanglePaper(new List <double> {
                    2, 4
                }, Color.Black),
                new TrianglePaper(new List <double> {
                    2, 4, 5
                }, Color.Blue)
            };

            var box    = new Box(figures);
            var figure = new CirclePellicle(7);

            box.AddFigure(figure);

            IFigure[] result       = box.Figures;
            var       actualResult = new IFigure[20];

            for (var i = 0; i < actualResult.Length; i++)
            {
                if (i == figures.Count)
                {
                    actualResult[i] = figure;
                    break;
                }

                actualResult[i] = figures[i];
            }

            CollectionAssert.AreEqual(result, actualResult);
        }
Esempio n. 3
0
        public void AddFigure_FigureIsInBox_AddNewFigure()
        {
            // arrange
            var figures = new IFigure[20];

            figures[0] = new PaperRectangle(new List <double> {
                4, 6
            }, Color.Black);
            figures[1] = new PaperTriangle(new List <double> {
                3, 4, 5
            }, Color.Red);
            figures[2] = new PaperCircle(3, Color.Green);
            figures[3] = new PaperSquare(new List <double> {
                5
            }, Color.Green);
            var figure       = new FilmCircle(6);
            var actualResult = new Box(figures);

            actualResult.AddFigure(figure);
            var expected = new Box(figures);

            // act
            expected.AddFigure(figure);

            // assert;
            Assert.Equal(expected, actualResult);
        }
Esempio n. 4
0
        public void AddFigure_BoxIsClear_AddNewFigure()
        {
            // arrange
            var figures      = new IFigure[20];
            var figure       = new FilmCircle(6);
            var actualResult = new Box(figures);

            actualResult.AddFigure(figure);
            var expected = new Box(figures);

            // act
            expected.AddFigure(figure);

            // assert;
            Assert.Equal(expected, actualResult);
        }
Esempio n. 5
0
        public void AddFigureWhenFigureIsNotInBoxGetArgumentException()
        {
            var figures = new List <IFigure>
            {
                new RectanglePaper(new List <double> {
                    2, 4
                }, Color.Black),
                new TrianglePaper(new List <double> {
                    2, 4, 7
                }, Color.Blue)
            };

            var box    = new Box(figures);
            var figure = new TrianglePaper(new List <double> {
                2, 4, 7
            }, Color.Blue);

            box.AddFigure(figure);
        }
        public void AddFigure_WhenFigureIsNotInBox_GetArgumentException()
        {
            var sidesPaperRectangle = new List <double> {
                2, 4
            };
            var sidesPaperTriangle = new List <double> {
                2, 4, 7
            };

            var figures = new List <IFigure>
            {
                new PaperRectangle(sidesPaperRectangle, Color.Black),
                new PaperTriangle(sidesPaperTriangle, Color.Blue)
            };

            var box    = new Box(figures);
            var figure = new PaperTriangle(sidesPaperTriangle, Color.Blue);

            box.AddFigure(figure);
        }
        public void AddFigure_WhenFigureIsInBox_AddNewFigure()
        {
            var sidesPaperRectangle = new List <double> {
                2, 4
            };
            var sidesPaperTriangle = new List <double> {
                2, 4, 5
            };
            double radius = 7;

            var figures = new List <IFigure>
            {
                new PaperRectangle(sidesPaperRectangle, Color.Black),
                new PaperTriangle(sidesPaperTriangle, Color.Blue)
            };

            var box    = new Box(figures);
            var figure = new SkinCircle(radius);

            box.AddFigure(figure);

            IFigure[] result       = box.Figures;
            var       actualResult = new IFigure[20];

            for (var i = 0; i < actualResult.Length; i++)
            {
                if (i == figures.Count)
                {
                    actualResult[i] = figure;
                    break;
                }

                actualResult[i] = figures[i];
            }

            CollectionAssert.AreEqual(result, actualResult);
        }
Esempio n. 8
0
 public void AddFigure_NotUniqFigure_ArgumentException(IFigure figure)
 {
     Assert.ThrowsException <ArgumentException>(() => Box.AddFigure(figure));
 }
Esempio n. 9
0
 public void AddFigure_UniqFigure_PositiveTestResult(IFigure figure)
 {
     Box.AddFigure(figure);
     Assert.AreEqual(figure, Box.ViewFigure(Box.CurrentFiguresCount));
 }