public virtual void test_ratePointSensitivity_afterValuation()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            assertEquals(test.ratePointSensitivity(OBS_AFTER, GBP), FxIndexSensitivity.of(OBS_AFTER, GBP, 1d));
            assertEquals(test.ratePointSensitivity(OBS_AFTER, USD), FxIndexSensitivity.of(OBS_AFTER, USD, 1d));
        }
        //-------------------------------------------------------------------------
        public virtual void test_ratePointSensitivity_fixing()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            assertEquals(test.ratePointSensitivity(OBS_BEFORE, GBP), PointSensitivityBuilder.none());
            assertEquals(test.ratePointSensitivity(OBS_VAL, GBP), PointSensitivityBuilder.none());
        }
        public virtual void test_ratePointSensitivity_onValuation_noFixing()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES_EMPTY);

            assertEquals(test.ratePointSensitivity(OBS_VAL, GBP), FxIndexSensitivity.of(OBS_VAL, GBP, 1d));
            assertEquals(test.ratePointSensitivity(OBS_VAL, USD), FxIndexSensitivity.of(OBS_VAL, USD, 1d));
        }
        public virtual void test_rate_onValuation_fixing()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            assertEquals(test.rate(OBS_VAL, GBP), RATE_VAL);
            assertEquals(test.rate(OBS_VAL, USD), 1d / RATE_VAL);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            coverImmutableBean(test);
            ForwardFxIndexRates test2 = ForwardFxIndexRates.of(EUR_GBP_ECB, FWD_RATES_EUR_GBP, SERIES_MINIMAL);

            coverBeanEquals(test, test2);
        }
        public virtual void test_of_withFixings()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.Fixings, SERIES);
            assertEquals(test.FxForwardRates, FWD_RATES);
        }
        //-------------------------------------------------------------------------
        //proper end-to-end tests are elsewhere
        public virtual void test_parameterSensitivity()
        {
            ForwardFxIndexRates test  = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);
            FxIndexSensitivity  point = FxIndexSensitivity.of(OBS_VAL, GBP, 1d);

            assertEquals(test.parameterSensitivity(point).size(), 2);
            FxIndexSensitivity point2 = FxIndexSensitivity.of(OBS_VAL, USD, 1d);

            assertEquals(test.parameterSensitivity(point2).size(), 2);
        }
        public virtual void test_rate_afterValuation()
        {
            ForwardFxIndexRates test         = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);
            LocalDate           maturityDate = GBP_USD_WM.calculateMaturityFromFixing(DATE_AFTER, REF_DATA);
            double dfCcyBaseAtMaturity       = DFCURVE_GBP.discountFactor(maturityDate);
            double dfCcyCounterAtMaturity    = DFCURVE_USD.discountFactor(maturityDate);
            double expected = FX_RATE.fxRate(GBP, USD) * (dfCcyBaseAtMaturity / dfCcyCounterAtMaturity);

            assertEquals(test.rate(OBS_AFTER, GBP), expected, 1e-8);
            assertEquals(test.rate(OBS_AFTER, USD), 1d / expected, 1e-8);
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ForwardFxIndexRates other = (ForwardFxIndexRates)obj;
         return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(fxForwardRates, other.fxForwardRates) && JodaBeanUtils.equal(fixings, other.fixings));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_of_withoutFixings()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES);

            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.Fixings, SERIES_EMPTY);
            assertEquals(test.FxForwardRates, FWD_RATES);
            assertEquals(test.findData(CURVE1.Name), CURVE1);
            assertEquals(test.findData(CURVE2.Name), CURVE2);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            assertEquals(test.ParameterCount, FWD_RATES.ParameterCount);
            assertEquals(test.getParameter(0), FWD_RATES.getParameter(0));
            assertEquals(test.getParameterMetadata(0), FWD_RATES.getParameterMetadata(0));
            assertEquals(test.withParameter(0, 1d).FxForwardRates, FWD_RATES.withParameter(0, 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).FxForwardRates, FWD_RATES.withPerturbation((i, v, m) => v + 1d));
        }
        public virtual void test_ratePointSensitivity_nonMatchingCurrency()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES);

            assertThrowsIllegalArg(() => test.ratePointSensitivity(OBS_EUR_VAL, EUR));
        }
        public virtual void test_rate_beforeValuation_noFixing_notEmptySeries()
        {
            ForwardFxIndexRates test = ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES, SERIES_MINIMAL);

            assertThrowsIllegalArg(() => test.rate(OBS_BEFORE, GBP));
        }
 public virtual void test_of_nonMatchingCurrency()
 {
     assertThrowsIllegalArg(() => ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES_USD_GBP, SERIES));
     assertThrowsIllegalArg(() => ForwardFxIndexRates.of(GBP_USD_WM, FWD_RATES_EUR_GBP, SERIES));
 }