//-------------------------------------------------------------------------
        public virtual void test_discountFactor()
        {
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double expected = Math.Pow(1.0d + CURVE.yValue(relativeYearFraction) / CMP_PERIOD, -CMP_PERIOD * relativeYearFraction);

            assertEquals(test.discountFactor(DATE_AFTER), expected);
        }
        public virtual void test_zeroRatePointSensitivity_sensitivityCurrency()
        {
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double df = test.discountFactor(DATE_AFTER);
            ZeroRateSensitivity expected = ZeroRateSensitivity.of(GBP, relativeYearFraction, USD, -df * relativeYearFraction);

            assertEquals(test.zeroRatePointSensitivity(DATE_AFTER, USD), expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_discountFactorWithSpread_continuous()
        {
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double df       = test.discountFactor(DATE_AFTER);
            double expected = df * Math.Exp(-SPREAD * relativeYearFraction);

            assertEquals(test.discountFactorWithSpread(DATE_AFTER, SPREAD, CONTINUOUS, 0), expected, TOLERANCE_DF);
        }
        //-------------------------------------------------------------------------
        public virtual void test_zeroRate()
        {
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double discountFactor = test.discountFactor(DATE_AFTER);
            double zeroRate       = test.zeroRate(DATE_AFTER);

            assertEquals(Math.Exp(-zeroRate * relativeYearFraction), discountFactor);
        }
        public virtual void test_discountFactorWithSpread_periodic()
        {
            int periodPerYear = 4;
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double discountFactorBase            = test.discountFactor(DATE_AFTER);
            double onePlus  = Math.Pow(discountFactorBase, -1.0d / (periodPerYear * relativeYearFraction));
            double expected = Math.Pow(onePlus + SPREAD / periodPerYear, -periodPerYear * relativeYearFraction);

            assertEquals(test.discountFactorWithSpread(DATE_AFTER, SPREAD, PERIODIC, periodPerYear), expected, TOLERANCE_DF);
        }
        public virtual void test_zeroRatePointSensitivityWithSpread_sensitivityCurrency_periodic()
        {
            int periodPerYear = 4;
            ZeroRatePeriodicDiscountFactors test = ZeroRatePeriodicDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction          = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double df     = test.discountFactor(DATE_AFTER);
            double z      = -1.0 / relativeYearFraction * Math.Log(df);
            double shift  = 1.0E-6;
            double zP     = z + shift;
            double zM     = z - shift;
            double dfSP   = Math.Pow(Math.Pow(Math.Exp(-zP * relativeYearFraction), -1.0 / (relativeYearFraction * periodPerYear)) + SPREAD / periodPerYear, -relativeYearFraction * periodPerYear);
            double dfSM   = Math.Pow(Math.Pow(Math.Exp(-zM * relativeYearFraction), -1.0 / (relativeYearFraction * periodPerYear)) + SPREAD / periodPerYear, -relativeYearFraction * periodPerYear);
            double ddfSdz = (dfSP - dfSM) / (2 * shift);
            ZeroRateSensitivity expected = ZeroRateSensitivity.of(GBP, relativeYearFraction, USD, ddfSdz);
            ZeroRateSensitivity computed = test.zeroRatePointSensitivityWithSpread(DATE_AFTER, USD, SPREAD, PERIODIC, periodPerYear);

            assertTrue(computed.compareKey(expected) == 0);
            assertEquals(computed.Sensitivity, expected.Sensitivity, TOLERANCE_DELTA_FD);
        }