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(); }
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(); }
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(); }
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(); }
private bool HaveIntersectionWithAnotherRectangle(Rectangle rectangle) { return(rectangles.Any(anotherRectangle => RectanglesChecker.HaveIntersection(rectangle, anotherRectangle))); }
private bool IsPlacedInAnotherRectangle(Rectangle rectangle) { return(rectangles.Any(anotherRectangle => RectanglesChecker.IsNestedRectangle(rectangle, anotherRectangle) || RectanglesChecker.IsNestedRectangle(anotherRectangle, rectangle))); }