Esempio n. 1
0
        public void ComplexMoveRectangles()
        {
            var rectangles = Generate().ToList();
            var imageS     = PaintHelper.CalculateImageSize(rectangles);
            var offset     = PaintHelper.CalculateCenterLocation(imageS);

            var moved = rectangles.Select(x => new Rectangle(new Point(x.X + offset.X, x.Y + offset.Y), x.Size));

            moved.All(x => OnPicture(imageS, x)).Should().BeTrue();
        }
Esempio n. 2
0
        public void CalculateCanvasSize()
        {
            var rectangles = new List <Rectangle>
            {
                new Rectangle(new Point(10, 10), new Size(10, 10)),
                new Rectangle(new Point(-10, 10), new Size(10, 10)),
                new Rectangle(new Point(10, -10), new Size(10, 10))
            };

            var size = PaintHelper.CalculateImageSize(rectangles);

            size.ShouldBeEquivalentTo(new Size(40, 40));
        }