Example #1
0
        public void IsNestedRectangle_ReturnFalse(int x, int y, int width, int height)
        {
            var nestedRectangle = layouter.PutNextRectangle(new Size(width, height), new Point(x, y));
            var mainRectangle   = layouter.PutNextRectangle(new Size(20, 20), new Point(5, 5));

            RectanglesChecker.IsNestedRectangle(nestedRectangle, mainRectangle).Should().BeFalse();
        }
Example #2
0
        public void HaveIntersection_ReturnFalse(int x, int y, int width, int height)
        {
            var staticRectangle = layouter.PutNextRectangle(new Size(15, 15), new Point(5, 0));
            var rectangle       = layouter.PutNextRectangle(new Size(width, height), new Point(x, y));

            RectanglesChecker.HaveIntersection(rectangle, staticRectangle).Should().BeFalse();
        }
Example #3
0
        public void ReturnTwoNotIntersectingRectangles()
        {
            var rnd    = new Random();
            var first  = layouter.PutNextRectangle(new Size(rnd.Next(1, 100), rnd.Next(1, 100)));
            var second = layouter.PutNextRectangle(new Size(rnd.Next(1, 100), rnd.Next(1, 100)));

            RectanglesChecker.HaveIntersection(first, second).Should().BeFalse();
        }
Example #4
0
        public void ReturnTwoNotNestedRectangles()
        {
            var rnd    = new Random();
            var first  = layouter.PutNextRectangle(new Size(rnd.Next(1, 100), rnd.Next(1, 100)));
            var second = layouter.PutNextRectangle(new Size(rnd.Next(1, 100), rnd.Next(1, 100)));

            RectanglesChecker.IsNestedRectangle(first, second).Should().BeFalse();
            RectanglesChecker.IsNestedRectangle(second, first).Should().BeFalse();
        }
Example #5
0
 private bool HaveIntersectionWithAnotherRectangle(Rectangle rectangle)
 {
     return(rectangles.Any(anotherRectangle => RectanglesChecker.HaveIntersection(rectangle, anotherRectangle)));
 }
Example #6
0
 private bool IsPlacedInAnotherRectangle(Rectangle rectangle)
 {
     return(rectangles.Any(anotherRectangle => RectanglesChecker.IsNestedRectangle(rectangle, anotherRectangle) ||
                           RectanglesChecker.IsNestedRectangle(anotherRectangle, rectangle)));
 }