示例#1
0
        public void ShapeRegionFromShapeScanYProxyToShape()
        {
            int         yToScan = 10;
            ShapeRegion region  = new ShapeRegion(this.pathMock.Object);

            this.pathMock
            .Setup(
                x => x.FindIntersections(
                    It.IsAny <PointF>(),
                    It.IsAny <PointF>(),
                    It.IsAny <PointF[]>(),
                    It.IsAny <int>())).Callback <PointF, PointF, PointF[], int>(
                (s, e, b, o) =>
            {
                Assert.Equal(yToScan, s.Y);
                Assert.Equal(yToScan, e.Y);
                Assert.True(s.X < this.bounds.Left);
                Assert.True(e.X > this.bounds.Right);
            }).Returns(0);

            int i = region.Scan(yToScan, new float[0], 0);

            this.pathMock.Verify(
                x => x.FindIntersections(It.IsAny <PointF>(), It.IsAny <PointF>(), It.IsAny <PointF[]>(), It.IsAny <int>()),
                Times.Once);
        }
示例#2
0
        public void ShapeRegionFromPathScanYProxyToShape()
        {
            MockPath path    = this.pathMock.Object;
            int      yToScan = path.TestYToScan;
            var      region  = new ShapeRegion(path);

            int i = region.Scan(yToScan, new float[path.TestFindIntersectionsResult], Configuration.Default, IntersectionRule.OddEven);

            Assert.Equal(path.TestFindIntersectionsResult, i);
            Assert.Equal(1, path.TestFindIntersectionsInvocationCounter);
        }
示例#3
0
        public void ShapeRegionFromPathScanYProxyToShape()
        {
            int         yToScan = 10;
            ShapeRegion region  = new ShapeRegion(pathMock.Object);

            pathMock.Setup(x => x.FindIntersections(It.IsAny <Vector2>(), It.IsAny <Vector2>(), It.IsAny <Vector2[]>(), It.IsAny <int>(), It.IsAny <int>()))
            .Callback <Vector2, Vector2, Vector2[], int, int>((s, e, b, c, o) => {
                Assert.Equal(yToScan, s.Y);
                Assert.Equal(yToScan, e.Y);
                Assert.True(s.X < bounds.Left);
                Assert.True(e.X > bounds.Right);
            }).Returns(0);

            int i = region.Scan(yToScan, new float[0], 0, 0);

            pathMock.Verify(x => x.FindIntersections(It.IsAny <Vector2>(), It.IsAny <Vector2>(), It.IsAny <Vector2[]>(), It.IsAny <int>(), It.IsAny <int>()), Times.Once);
        }