public virtual void BasicTests()
        {
            SolidColorBrushInterpolator interpolator = new SolidColorBrushInterpolator
            {
                DataMaximum = 100,
                DataMinimum = 0,
                From        = Color.FromArgb(200, 0, 0, 0),
                To          = Color.FromArgb(100, 100, 200, 10)
            };

            // Regular tests
            BrushAssert((SolidColorBrush)interpolator.Interpolate(1), 199, 1, 2, 0);
            BrushAssert((SolidColorBrush)interpolator.Interpolate(0), 200, 0, 0, 0);
            BrushAssert((SolidColorBrush)interpolator.Interpolate(100), 100, 100, 200, 10);

            // TODO: Right now colors are working for child level only
            BrushAssert((SolidColorBrush)interpolator.Interpolate(200), 0, 200, 144, 20);
        }
        public virtual void BasicTests()
        {
            SolidColorBrushInterpolator interpolator = new SolidColorBrushInterpolator
            {
                DataMaximum = 100,
                DataMinimum = 0,
                From = Color.FromArgb(200, 0, 0, 0),
                To = Color.FromArgb(100, 100, 200, 10)
            };

            // Regular tests
            BrushAssert((SolidColorBrush)interpolator.Interpolate(1), 199, 1, 2, 0);
            BrushAssert((SolidColorBrush)interpolator.Interpolate(0), 200, 0, 0, 0);
            BrushAssert((SolidColorBrush)interpolator.Interpolate(100), 100, 100, 200, 10);

            // TODO: Right now colors are working for child level only 
            BrushAssert((SolidColorBrush)interpolator.Interpolate(200), 0, 200, 144, 20);
        }
        public virtual void DataMaximumMinimumTests()
        {
            const double DataBorder = 100;

            // DataMinimum == DataMaximum
            SolidColorBrushInterpolator interpolator = new SolidColorBrushInterpolator
            {
                DataMaximum = DataBorder,
                DataMinimum = DataBorder,
                From        = Color.FromArgb(200, 0, 0, 0),
                To          = Color.FromArgb(100, 100, 200, 10)
            };

            BrushAssert(
                (SolidColorBrush)interpolator.Interpolate(1),
                interpolator.From.A,
                interpolator.From.R,
                interpolator.From.G,
                interpolator.From.B);

            //// No exception for close values

            // Calculate minimum double value that (dataBorder - value) yields
            // a different number
            double minDoubleDiff = 1;

            while ((DataBorder - (minDoubleDiff / 2)) != DataBorder)
            {
                minDoubleDiff /= 2;
            }

            // No exception (div by 0) for very close values
            interpolator.DataMinimum = DataBorder - minDoubleDiff;
            interpolator.Interpolate(0.01);
            interpolator.DataMinimum = DataBorder - (minDoubleDiff / 2);
            interpolator.Interpolate(0.01);
        }
        private void InitializeBrush(LinearGradientBrush br)
        {
            if (br == null)
                throw new ArgumentNullException("br");

            //set start and end interpolators
            double start = br.StartPoint.X;
            double end = br.EndPoint.X;

            if (br.GradientStops.Count < 2)
            {
                throw new Exception("2 Gradiant Stops must exist");
            }

            SolidColorBrushInterpolator startInterpolator = new SolidColorBrushInterpolator();
            startInterpolator.DataMinimum = start;
            startInterpolator.DataMaximum = br.GradientStops[1].Offset;
            startInterpolator.From = br.GradientStops[0].Color;
            startInterpolator.To = br.GradientStops[1].Color;
            interpolators.Add(startInterpolator);

            for (int i = 1; i < br.GradientStops.Count - 1; i++)
            {
                SolidColorBrushInterpolator inter = new SolidColorBrushInterpolator();
                inter.DataMinimum = br.GradientStops[i].Offset;
                inter.DataMaximum = br.GradientStops[i + 1].Offset;
                inter.From = br.GradientStops[i].Color;
                inter.To = br.GradientStops[i + 1].Color;
                interpolators.Add(inter);
            }
        }
        public virtual void DataMaximumMinimumTests()
        {
            const double DataBorder = 100;

            // DataMinimum == DataMaximum
            SolidColorBrushInterpolator interpolator = new SolidColorBrushInterpolator
            {
                DataMaximum = DataBorder,
                DataMinimum = DataBorder,
                From = Color.FromArgb(200, 0, 0, 0),
                To = Color.FromArgb(100, 100, 200, 10)
            };

            BrushAssert(
                (SolidColorBrush)interpolator.Interpolate(1),
                interpolator.From.A,
                interpolator.From.R,
                interpolator.From.G,
                interpolator.From.B);

            //// No exception for close values 

            // Calculate minimum double value that (dataBorder - value) yields 
            // a different number
            double minDoubleDiff = 1;
            while ((DataBorder - (minDoubleDiff / 2)) != DataBorder)
            {
                minDoubleDiff /= 2;
            }

            // No exception (div by 0) for very close values 
            interpolator.DataMinimum = DataBorder - minDoubleDiff;
            interpolator.Interpolate(0.01);
            interpolator.DataMinimum = DataBorder - (minDoubleDiff / 2);
            interpolator.Interpolate(0.01);
        }