コード例 #1
0
        public void OverLappingReturns1NewShape()
        {
            IEnumerable <IPath> shapes = this.Clip(this.bigSquare, this.topLeft);

            Assert.Single(shapes);
            Assert.DoesNotContain(shapes, x => RectangularPolygonValueComparer.Equals(this.bigSquare, x));
            Assert.DoesNotContain(shapes, x => RectangularPolygonValueComparer.Equals(this.topLeft, x));
        }
コード例 #2
0
        public void TouchingButNotOverlapping()
        {
            IEnumerable <IPath> shapes = this.Clip(this.topMiddle, this.topLeft);

            Assert.Single(shapes);
            Assert.DoesNotContain(shapes, x => RectangularPolygonValueComparer.Equals(this.topMiddle, x));
            Assert.DoesNotContain(shapes, x => RectangularPolygonValueComparer.Equals(this.topLeft, x));
        }
コード例 #3
0
        public void OverlappingButNotCrossingReturnsOrigionalShapes()
        {
            IEnumerable <RectangularPolygon> shapes = this.Clip(this.bigSquare, this.hole)
                                                      .OfType <Polygon>().Select(x => (RectangularPolygon)x);

            Assert.Equal(2, shapes.Count());
            Assert.Contains(shapes, x => RectangularPolygonValueComparer.Equals(this.bigSquare, x));
            Assert.Contains(shapes, x => RectangularPolygonValueComparer.Equals(this.hole, x));
        }
コード例 #4
0
        public void BrushDefaultOptions()
        {
            this.operations.Clear(this.brush, this.rectangle);

            FillPathProcessor processor = this.Verify <FillPathProcessor>();

            Assert.Equal(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Region));
            Assert.Equal(this.brush, processor.Brush);
        }
コード例 #5
0
        public void CorrectlySetsPenAndPathDefaultOptions()
        {
            this.operations.Draw(this.pen, this.rectangle);

            DrawPathProcessor processor = this.Verify <DrawPathProcessor>();

            Assert.Equal(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Path));
            Assert.Equal(this.pen, processor.Pen);
        }
コード例 #6
0
        public void NonOverlapping()
        {
            IEnumerable <RectangularPolygon> shapes = this.Clip(this.topLeft, this.topRight)
                                                      .OfType <Polygon>().Select(x => (RectangularPolygon)x);

            Assert.Single(shapes);
            Assert.Contains(
                shapes, x => RectangularPolygonValueComparer.Equals(this.topLeft, x));

            Assert.DoesNotContain(this.topRight, shapes);
        }
コード例 #7
0
        public void BrushAndThicknessDefaultOptions()
        {
            this.operations.Draw(this.pen.StrokeFill, 10, this.rectangle);

            DrawPathProcessor processor = this.Verify <DrawPathProcessor>();

            Assert.Equal(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Path));
            Assert.NotEqual(this.pen, processor.Pen);
            Assert.Equal(this.pen.StrokeFill, processor.Pen.StrokeFill);
            Assert.Equal(10, processor.Pen.StrokeWidth);
        }
コード例 #8
0
        public void JointAndEndCapStyle()
        {
            this.operations.Draw(new DrawingOptions(), this.pen.StrokeFill, 10, this.rectangle);

            DrawPathProcessor processor = this.Verify <DrawPathProcessor>();

            Assert.NotEqual(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Path));
            Assert.NotEqual(this.pen, processor.Pen);
            Assert.Equal(this.pen.JointStyle, processor.Pen.JointStyle);
            Assert.Equal(this.pen.EndCapStyle, processor.Pen.EndCapStyle);
        }
コード例 #9
0
        public void ColorAndThicknessDefaultOptions()
        {
            this.operations.Clear(Color.Red, this.rectangle);

            FillPathProcessor processor = this.Verify <FillPathProcessor>();

            Assert.Equal(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Region));
            Assert.NotEqual(this.brush, processor.Brush);
            SolidBrush brush = Assert.IsType <SolidBrush>(processor.Brush);

            Assert.Equal(Color.Red, brush.Color);
        }
コード例 #10
0
        public void ColorAndThickness()
        {
            this.operations.Draw(new DrawingOptions(), Color.Red, 10, this.rectangle);

            DrawPathProcessor processor = this.Verify <DrawPathProcessor>();

            Assert.NotEqual(this.shapeOptions, processor.Options.ShapeOptions);
            Assert.True(RectangularPolygonValueComparer.Equals(this.RectanglePolygon, processor.Path));
            Assert.NotEqual(this.pen, processor.Pen);
            SolidBrush brush = Assert.IsType <SolidBrush>(processor.Pen.StrokeFill);

            Assert.Equal(Color.Red, brush.Color);
            Assert.Equal(10, processor.Pen.StrokeWidth);
        }