Exemplo n.º 1
0
        public virtual void testToString()
        {
            OutputCurrenciesFunction fn   = new OutputCurrenciesFunction();
            CalculationTaskCell      cell = CalculationTaskCell.of(1, 2, TestingMeasures.PRESENT_VALUE, REPORTING_CURRENCY_USD);
            CalculationTask          task = CalculationTask.of(TARGET, fn, cell);

            assertThat(task.ToString()).isEqualTo("CalculationTask[CalculationTaskCell[(1, 2), measure=PresentValue, currency=Specific:USD]]");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tests that no requirements are added when not performing currency conversion.
        /// </summary>
        public virtual void fxConversionRequirements_noConversion()
        {
            OutputCurrenciesFunction fn           = new OutputCurrenciesFunction();
            CalculationTaskCell      cell         = CalculationTaskCell.of(0, 0, TestingMeasures.PRESENT_VALUE, ReportingCurrency.NONE);
            CalculationTask          task         = CalculationTask.of(TARGET, fn, cell);
            MarketDataRequirements   requirements = task.requirements(REF_DATA);

            assertThat(requirements.NonObservables).Empty;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Tests that requirements are added for the FX rates needed to convert the results into the reporting currency.
        /// </summary>
        public virtual void fxConversionRequirements()
        {
            OutputCurrenciesFunction fn           = new OutputCurrenciesFunction();
            CalculationTaskCell      cell         = CalculationTaskCell.of(0, 0, TestingMeasures.PRESENT_VALUE, REPORTING_CURRENCY_USD);
            CalculationTask          task         = CalculationTask.of(TARGET, fn, cell);
            MarketDataRequirements   requirements = task.requirements(REF_DATA);

            assertThat(requirements.NonObservables).containsOnly(FxRateId.of(GBP, USD, OBS_SOURCE), FxRateId.of(EUR, USD, OBS_SOURCE));
        }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            OutputCurrenciesFunction fn   = new OutputCurrenciesFunction();
            CalculationTaskCell      cell = CalculationTaskCell.of(1, 2, TestingMeasures.PRESENT_VALUE, REPORTING_CURRENCY_USD);
            CalculationTask          test = CalculationTask.of(TARGET, fn, cell);

            coverImmutableBean(test);

            OutputCurrenciesFunction fn2   = new OutputCurrenciesFunction();
            CalculationTaskCell      cell2 = CalculationTaskCell.of(1, 3, TestingMeasures.PRESENT_VALUE, REPORTING_CURRENCY_USD);
            CalculationTask          test2 = CalculationTask.of(new TestTarget(), fn2, cell2);

            coverBeanEquals(test, test2);
            assertNotNull(CalculationTask.meta());
        }