示例#1
0
        public void RectangleOverlap_DetectsFirstRectangleContainsSecondRectangle()
        {
            var rec1 = new Rectangle(new Point() { X = -5, Y = -5 }, new Point() { X = 5, Y = 5 });

             var rec2 = new Rectangle(new Point() { X = 1, Y = 1 }, new Point() { X = 0, Y = 0 });

             rec1.Overlaps(rec2).ShouldBe(true);
        }
示例#2
0
        public void RectangleOverlap_DetectsPlusShapedIntersection()
        {
            var rec1 = new Rectangle(new Point() { X = -5, Y = 0 }, new Point() { X = 5, Y = 1 });

             var rec2 = new Rectangle(new Point() { X = 0, Y = -5 }, new Point() { X = 1, Y = 5 });

             rec1.Overlaps(rec2).ShouldBe(true);
        }
示例#3
0
        public void RectanglesDoNotOverlap()
        {
            var rec1 = new Rectangle(new Point() { X = -5, Y = -5 }, new Point() { X = -4, Y = -4 });

            var rec2 = new Rectangle(new Point() { X = 5, Y = 5 }, new Point() { X = 4, Y = 4 });

            rec1.Overlaps(rec2).ShouldBe(false);
        }