//-------------------------------------------------------------------------
        public virtual void test_ratePointSensitivity()
        {
            DiscountFxForwardRates test = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);

            assertEquals(test.ratePointSensitivity(GBP, DATE_REF), FxForwardSensitivity.of(CURRENCY_PAIR, GBP, DATE_REF, 1d));
            assertEquals(test.ratePointSensitivity(USD, DATE_REF), FxForwardSensitivity.of(CURRENCY_PAIR, USD, DATE_REF, 1d));
        }
        //-------------------------------------------------------------------------
        public virtual void test_of()
        {
            DiscountFxForwardRates test = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);

            assertEquals(test.CurrencyPair, CURRENCY_PAIR);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.BaseCurrencyDiscountFactors, DFCURVE_GBP);
            assertEquals(test.CounterCurrencyDiscountFactors, DFCURVE_USD);
            assertEquals(test.FxRateProvider, FX_RATE);
            assertEquals(test.findData(CURVE1.Name), CURVE1);
            assertEquals(test.findData(CURVE2.Name), CURVE2);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);

            int baseSize = DFCURVE_USD.ParameterCount;

            assertEquals(test.ParameterCount, DFCURVE_GBP.ParameterCount + baseSize);
            assertEquals(test.getParameter(0), DFCURVE_GBP.getParameter(0));
            assertEquals(test.getParameter(baseSize), DFCURVE_USD.getParameter(0));
            assertEquals(test.getParameterMetadata(0), DFCURVE_GBP.getParameterMetadata(0));
            assertEquals(test.getParameterMetadata(baseSize), DFCURVE_USD.getParameterMetadata(0));
            assertEquals(test.withParameter(0, 1d).BaseCurrencyDiscountFactors, DFCURVE_GBP.withParameter(0, 1d));
            assertEquals(test.withParameter(0, 1d).CounterCurrencyDiscountFactors, DFCURVE_USD);
            assertEquals(test.withParameter(baseSize, 1d).BaseCurrencyDiscountFactors, DFCURVE_GBP);
            assertEquals(test.withParameter(baseSize, 1d).CounterCurrencyDiscountFactors, DFCURVE_USD.withParameter(0, 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).BaseCurrencyDiscountFactors, DFCURVE_GBP.withPerturbation((i, v, m) => v + 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).CounterCurrencyDiscountFactors, DFCURVE_USD.withPerturbation((i, v, m) => v + 1d));
        }
        //-------------------------------------------------------------------------
        //proper end-to-end tests are elsewhere
        public virtual void test_parameterSensitivity()
        {
            DiscountFxForwardRates test  = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);
            FxForwardSensitivity   point = FxForwardSensitivity.of(CURRENCY_PAIR, GBP, DATE_VAL, 1d);

            assertEquals(test.parameterSensitivity(point).size(), 2);
            FxForwardSensitivity point2 = FxForwardSensitivity.of(CURRENCY_PAIR, USD, DATE_VAL, 1d);

            assertEquals(test.parameterSensitivity(point2).size(), 2);
        }
        //-------------------------------------------------------------------------
        public virtual void test_rateFxSpotSensitivity()
        {
            DiscountFxForwardRates test   = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);
            double dfCcyBaseAtMaturity    = DFCURVE_GBP.discountFactor(DATE_REF);
            double dfCcyCounterAtMaturity = DFCURVE_USD.discountFactor(DATE_REF);
            double expected = dfCcyBaseAtMaturity / dfCcyCounterAtMaturity;

            assertEquals(test.rateFxSpotSensitivity(GBP, DATE_REF), expected, 1e-12);
            assertEquals(test.rateFxSpotSensitivity(USD, DATE_REF), 1d / expected, 1e-12);
        }
        //-------------------------------------------------------------------------
        public virtual void test_withDiscountFactors()
        {
            DiscountFxForwardRates test = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);

            test = test.withDiscountFactors(DFCURVE_GBP2, DFCURVE_USD2);
            assertEquals(test.CurrencyPair, CURRENCY_PAIR);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.BaseCurrencyDiscountFactors, DFCURVE_GBP2);
            assertEquals(test.CounterCurrencyDiscountFactors, DFCURVE_USD2);
            assertEquals(test.FxRateProvider, FX_RATE);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            DiscountFxForwardRates test1 = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);

            coverImmutableBean(test1);
            DiscountFxForwardRates test2 = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE.inverse(), DFCURVE_GBP2, DFCURVE_USD2);

            coverBeanEquals(test1, test2);
            DiscountFxForwardRates test3 = DiscountFxForwardRates.of(CurrencyPair.of(USD, EUR), FxRate.of(EUR, USD, 1.2d), DFCURVE_USD, ZeroRateDiscountFactors.of(EUR, DATE_VAL, CURVE2));

            coverBeanEquals(test1, test3);
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         DiscountFxForwardRates other = (DiscountFxForwardRates)obj;
         return(JodaBeanUtils.equal(currencyPair, other.currencyPair) && JodaBeanUtils.equal(fxRateProvider, other.fxRateProvider) && JodaBeanUtils.equal(baseCurrencyDiscountFactors, other.baseCurrencyDiscountFactors) && JodaBeanUtils.equal(counterCurrencyDiscountFactors, other.counterCurrencyDiscountFactors));
     }
     return(false);
 }
        public virtual void test_rateFxSpotSensitivity_nonMatchingCurrency()
        {
            DiscountFxForwardRates test = DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_USD);

            assertThrowsIllegalArg(() => test.rateFxSpotSensitivity(EUR, DATE_VAL));
        }
 public virtual void test_builder()
 {
     assertThrowsIllegalArg(() => DiscountFxForwardRates.meta().builder().set(DiscountFxForwardRates.meta().currencyPair(), CurrencyPair.parse("GBP/USD")).build());
     assertThrowsIllegalArg(() => DiscountFxForwardRates.meta().builder().set(DiscountFxForwardRates.meta().currencyPair().name(), CurrencyPair.parse("GBP/USD")).build());
 }
        public virtual void test_of_nonMatchingValuationDates()
        {
            DiscountFactors curve2 = ZeroRateDiscountFactors.of(USD, DATE_REF, CURVE2);

            assertThrowsIllegalArg(() => DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, curve2));
        }
 public virtual void test_of_nonMatchingCurrency()
 {
     assertThrowsIllegalArg(() => DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_GBP, DFCURVE_GBP));
     assertThrowsIllegalArg(() => DiscountFxForwardRates.of(CURRENCY_PAIR, FX_RATE, DFCURVE_USD, DFCURVE_USD));
 }