public void Test02LinearInterpolateTest()
        {
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();
            double actual = siif.LinearInterpolate(_linXArray, null, 0);

            Assert.AreEqual(0d, actual);
        }
        public void Test05CubicHermiteSplineInterpolateTest()
        {
            double expected = 0;
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();
            double actual = siif.CubicHermiteSplineInterpolate(_chsXArray, null, 0);

            Assert.AreEqual(expected, actual);
        }
        public void Test01LinearInterpolateTest()
        {
            double expected = 0;
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();
            double actual = siif.LinearInterpolate(null, _linYArray, 0);

            Assert.AreEqual(expected, actual);
        }
        public void Test07CubicHermiteSplineInterpolateTest()
        {
            double[] target = ArrayUtilities.DecimalArrayToDouble(_chsTarget);
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();

            for (int i = 0; i < target.Length; i++)
            {
                double actual = siif.CubicHermiteSplineInterpolate(_chsXArray, _chsYArray, target[i]);
                Assert.AreEqual(_chsExpected[i], (decimal)Math.Round(actual, 2));
            }
        }
        public void Test03LinearInterpolateTest()
        {
            double[] target = ArrayUtilities.DecimalArrayToDouble(_linInterpTarget);
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();

            for (int i = 0; i < target.Length; i++)
            {
                double actual = siif.LinearInterpolate(_linXArray, _linYArray, target[i]);
                Assert.AreEqual(_linExpected[i], (decimal)Math.Round(actual, 4));
            }
        }
        public void Test10BilinearInterpolateTest()
        {
            double[,] dataArray = null;
            double columnTarget             = 0;
            double rowTarget                = 0;
            double expected                 = 0;
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();
            double actual = siif.BilinearInterpolate(_bilinColumns,
                                                     _bilinRows, dataArray, columnTarget, rowTarget);

            Assert.AreEqual(expected, actual);
        }
        public void Test11BilinearInterpolateTest()
        {
            double[] columnTarget           = _bilinColumnTarget;
            double[] rowTarget              = _bilinRowTarget;
            double[] expected               = _bilinExpected;
            SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();

            for (int i = 0; i < rowTarget.Length; i++)
            {
                double actual = siif.BilinearInterpolate(_bilinColumns,
                                                         _bilinRows, _bilinData,
                                                         columnTarget[i], rowTarget[i]);
                Assert.AreEqual(expected[i], Math.Round(actual, 4));
            }
        }
        public void Test06CubicHermiteSplineInterpolateTest()
        {
            double expected     = 10.99; //0
            double target       = 10000;
            string expectedFail = "Cubic Hermite Spline now supports extrapolation";

            try
            {
                SABRInterpolationInterface siif = SABRInterpolationInterface.Instance();
                double actual = siif.CubicHermiteSplineInterpolate(_chsXArray, _chsYArray, target);
                Assert.AreEqual(expected, actual);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(expectedFail, ex.Message);
            }
        }