double GetCircularity()
        {
            Rectangle boundingBox = LayoutVisualizer.GetBoundingBox(layouter.WordRectangles);
            double    circularity = 1;

            if (boundingBox.Height != 0 && boundingBox.Width != 0)
            {
                if (boundingBox.Width > boundingBox.Height)
                {
                    circularity = (double)boundingBox.Height / boundingBox.Width;
                }
                else
                {
                    circularity = (double)boundingBox.Width / boundingBox.Height;
                }
            }
            return(circularity);
        }
        public void WordRectangles_ShouldBeCompact(Point center, Size minSize, Size maxSize, int sampleCount, double fillThreshold, bool shouldSucceed)
        {
            PrepareTestLayout(center, minSize, maxSize, sampleCount);
            Rectangle boundingBox    = LayoutVisualizer.GetBoundingBox(layouter.WordRectangles);
            double    circleRadius   = (double)Math.Max(boundingBox.Width, boundingBox.Height) / 2;
            double    circleArea     = Math.PI * circleRadius * circleRadius;
            double    rectanglesArea = layouter.WordRectangles.Select(r => r.Height * r.Width).Sum();
            double    fillRate       = rectanglesArea / circleArea;

            if (shouldSucceed)
            {
                fillRate.Should().BeGreaterOrEqualTo(fillThreshold);
            }
            else
            {
                fillRate.Should().BeLessThan(fillThreshold);
            }
        }