/// <summary>
        /// Validate that the data array can be cleared.
        /// </summary>
        public void SplineCanClearDataArrayThenAddAndInterpolate()
        {
            double[,] data = { { 0.0, 0.0 },
                               { 1.0, 1.0 },
                               { 2.0, 2.0 },
                               { 3.0, 3.0 }, };

            CubicSpline spline = new CubicSpline();

            // several tries
            for (int t = 0; t < 3; t++)
            {
                for (int i = 0; i < 4; i++)
                {
                    bool addResult = spline.AddDataPoint(data[i, 0], new double[] { data[i, 1] });
                    //Assert.IsTrue(addResult);
                }

                //Assert.AreEqual(4, spline.Count);
                //Assert.IsTrue(spline.CanInterpolate);

                // test interpolator
                Random random = new Random();
                for (int j = 0; j < 10; j++)
                {
                    double   x = random.NextDouble();
                    double[] y = spline.Interpolate(x);
                    //Assert.AreEqual(x, y[0]);
                }

                // test clear
                spline.Clear();
                //Assert.AreEqual(0, spline.Count);
                //Assert.IsFalse(spline.CanInterpolate);
            }
        }
        /// <summary>
        /// Validate that the data array can be cleared.
        /// </summary>        
        public void SplineCanClearDataArrayThenAddAndInterpolate()
        {
            double[,] data = {{0.0, 0.0},
                           {1.0, 1.0},
                           {2.0, 2.0},
                           {3.0, 3.0},
                          };
 
            CubicSpline spline = new CubicSpline();
 
            // several tries
            for (int t = 0; t < 3; t++)
            {
                for (int i = 0; i < 4; i++)
                {
                    bool addResult = spline.AddDataPoint(data[i, 0], new double[] { data[i, 1] });
                    //Assert.IsTrue(addResult);
                }
 
                //Assert.AreEqual(4, spline.Count);
                //Assert.IsTrue(spline.CanInterpolate);
 
                // test interpolator
                Random random = new Random();
                for (int j = 0; j < 10; j++)
                {
                    double x = random.NextDouble();
                    double[] y = spline.Interpolate(x);
                    //Assert.AreEqual(x, y[0]);
                }
 
                // test clear
                spline.Clear();
                //Assert.AreEqual(0, spline.Count);
                //Assert.IsFalse(spline.CanInterpolate);
            }
        }