private static string GetFileName(LinearBlockBar tickBar)
        {
            var value = double.IsNaN(tickBar.Value)
                ? string.Empty
                : $"_Value_{Math.Round(tickBar.Value, 0)}";

            var ticks = tickBar.Ticks != null
                ? $"_Ticks_{tickBar.Ticks}"
                : string.Empty;

            var tickFrequency = tickBar.TickFrequency > 0
                ? $"_TickFrequency_{tickBar.TickFrequency}"
                : string.Empty;

            var orientation = tickBar.Placement == TickBarPlacement.Left || tickBar.Placement == TickBarPlacement.Right
                ? "_Vertical"
                : "_Horizontal";

            var padding = tickBar.Padding.IsZero()
                ? string.Empty
                : $"_Padding_{tickBar.Padding}";

            return($@"LinearBlockBar_Min_{tickBar.Minimum}_Max_{tickBar.Maximum}{value}_IsDirectionReversed_{tickBar.IsDirectionReversed}{padding}_TickGap_{tickBar.TickGap}_StrokeThickness_{tickBar.StrokeThickness}{tickFrequency}{ticks}{orientation}.png"
                   .Replace(" ", "_"));
        }
        public void Overflow(TickBarPlacement placement, bool isDirectionReversed, double strokeThickness, string padding, string expected)
        {
            var tickBar = new LinearBlockBar
            {
                StrokeThickness     = strokeThickness,
                Minimum             = 0,
                Maximum             = 10,
                TickFrequency       = 1,
                TickGap             = 3,
                Stroke              = Brushes.Black,
                Fill                = Brushes.Red,
                Placement           = placement,
                IsDirectionReversed = isDirectionReversed,
                Padding             = padding.AsThickness(),
            };

            var gauge = new LinearGauge {
                Content = tickBar
            };

            gauge.Arrange(new Rect(new Size(10, 10)));
            Assert.AreEqual(expected, gauge.ContentOverflow.ToString());
            Assert.AreEqual(expected, tickBar.Overflow.ToString());

            gauge.Measure(new Size(10, 10));
            gauge.Arrange(new Rect(new Size(10, 10)));
            Assert.AreEqual(expected, gauge.ContentOverflow.ToString());
            Assert.AreEqual(expected, tickBar.Overflow.ToString());
        }
        private static void SaveImage(LinearBlockBar tickBar)
        {
            var size = tickBar.Placement.IsHorizontal()
                ? new Size(100, 10)
                : new Size(10, 100);

            Directory.CreateDirectory(@"C:\Temp\LinearBlockBar");
            tickBar.SaveImage(size, $@"C:\Temp\LinearBlockBar\{GetFileName(tickBar)}");
        }
        public void RenderWithValue(TestCase testCase)
        {
            var tickBar = new LinearBlockBar
            {
                StrokeThickness     = testCase.StrokeThickness,
                Minimum             = 0,
                Maximum             = 10,
                Value               = testCase.Value,
                TickFrequency       = testCase.TickFrequency,
                Ticks               = testCase.Ticks,
                TickGap             = testCase.TickGap,
                Stroke              = Brushes.Black,
                Fill                = Brushes.Red,
                Placement           = testCase.Placement,
                IsDirectionReversed = testCase.IsDirectionReversed,
                Padding             = testCase.Padding,
            };

            ImageAssert.AreEqual(GetFileName(tickBar), tickBar);
        }