public virtual void test_zeroRatePointSensitivityWithSpread_sensitivityCurrency_smallYearFraction()
        {
            SimpleDiscountFactors test     = SimpleDiscountFactors.of(GBP, DATE_VAL, CURVE);
            ZeroRateSensitivity   expected = ZeroRateSensitivity.of(GBP, 0d, USD, -0d);

            assertEquals(test.zeroRatePointSensitivityWithSpread(DATE_VAL, USD, SPREAD, PERIODIC, 2), expected);
        }
        public virtual void test_zeroRatePointSensitivityWithSpread_smallYearFraction()
        {
            SimpleDiscountFactors test     = SimpleDiscountFactors.of(GBP, DATE_VAL, CURVE);
            ZeroRateSensitivity   expected = ZeroRateSensitivity.of(GBP, 0d, -0d);

            assertEquals(test.zeroRatePointSensitivityWithSpread(DATE_VAL, SPREAD, CONTINUOUS, 0), expected);
        }
        public virtual void test_zeroRatePointSensitivityWithSpread_sensitivityCurrency_continuous()
        {
            SimpleDiscountFactors test  = SimpleDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double df = CURVE.yValue(relativeYearFraction) * Math.Exp(-SPREAD * relativeYearFraction);
            ZeroRateSensitivity expected = ZeroRateSensitivity.of(GBP, relativeYearFraction, USD, -df * relativeYearFraction);

            assertEquals(test.zeroRatePointSensitivityWithSpread(DATE_AFTER, USD, SPREAD, CONTINUOUS, 1), expected);
        }
        public virtual void test_zeroRatePointSensitivityWithSpread_sensitivityCurrency_periodic()
        {
            int periodPerYear           = 4;
            SimpleDiscountFactors test  = SimpleDiscountFactors.of(GBP, DATE_VAL, CURVE);
            double relativeYearFraction = ACT_365F.relativeYearFraction(DATE_VAL, DATE_AFTER);
            double df = CURVE.yValue(relativeYearFraction);
            double discountFactorUp      = df * Math.Exp(-EPS * relativeYearFraction);
            double discountFactorDw      = df * Math.Exp(EPS * relativeYearFraction);
            double rateUp                = (Math.Pow(discountFactorUp, -1d / periodPerYear / relativeYearFraction) - 1d) * periodPerYear;
            double rateDw                = (Math.Pow(discountFactorDw, -1d / periodPerYear / relativeYearFraction) - 1d) * periodPerYear;
            double expectedValue         = 0.5 / EPS * (discountFactorFromPeriodicallyCompoundedRate(rateUp + SPREAD, periodPerYear, relativeYearFraction) - discountFactorFromPeriodicallyCompoundedRate(rateDw + SPREAD, periodPerYear, relativeYearFraction));
            ZeroRateSensitivity computed = test.zeroRatePointSensitivityWithSpread(DATE_AFTER, USD, SPREAD, PERIODIC, periodPerYear);

            assertEquals(computed.Sensitivity, expectedValue, EPS);
            assertEquals(computed.Currency, USD);
            assertEquals(computed.CurveCurrency, GBP);
            assertEquals(computed.YearFraction, relativeYearFraction);
        }