Exemple #1
0
        public virtual void productPath()
        {
            ReportCalculationResults reportResults = ValuePathEvaluatorTest.reportResults();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> counterpartyResults = ValuePathEvaluator.evaluate("Trade.Product.Notional", reportResults);
            IList <Result <object> > counterpartyResults = ValuePathEvaluator.evaluate("Trade.Product.Notional", reportResults);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> expectedCounterparties = com.google.common.collect.ImmutableList.of(com.opengamma.strata.collect.result.Result.success(1_000_000d), com.opengamma.strata.collect.result.Result.success(10_000_000d), com.opengamma.strata.collect.result.Result.success(100_000_000d));
            IList <Result <object> > expectedCounterparties = ImmutableList.of(Result.success(1_000_000d), Result.success(10_000_000d), Result.success(100_000_000d));

            assertThat(counterpartyResults).isEqualTo(expectedCounterparties);
        }
Exemple #2
0
        public override ISet <string> tokens(Bean bean)
        {
            if (bean.propertyNames().size() == 1)
            {
                string        singlePropertyName = Iterables.getOnlyElement(bean.propertyNames());
                object        propertyValue      = bean.property(singlePropertyName).get();
                ISet <string> valueTokens        = ValuePathEvaluator.tokens(propertyValue);

                return(ImmutableSet.builder <string>().add(singlePropertyName).addAll(valueTokens).build());
            }
            else
            {
                return(bean.propertyNames());
            }
        }
Exemple #3
0
        public virtual void measurePath_failure_noMeasureName()
        {
            ReportCalculationResults reportResults = ValuePathEvaluatorTest.reportResults();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> results = ValuePathEvaluator.evaluate("Measures.", reportResults);
            IList <Result <object> > results = ValuePathEvaluator.evaluate("Measures.", reportResults);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: com.opengamma.strata.collect.result.Result<?> result = results.get(0);
            Result <object> result = results[0];

            assertThat(result.Failure).True;
            assertThat(result.Failure.Message).contains("PresentValue");
            assertThat(result.Failure.Message).contains("ParRate");
        }
Exemple #4
0
        public virtual void measurePath()
        {
            ReportCalculationResults reportResults = ValuePathEvaluatorTest.reportResults();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> currencyResults = ValuePathEvaluator.evaluate("Measures.PresentValue.Currency", reportResults);
            IList <Result <object> > currencyResults = ValuePathEvaluator.evaluate("Measures.PresentValue.Currency", reportResults);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> expectedCurrencies = com.google.common.collect.ImmutableList.of(com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.Currency.CAD), com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.Currency.AUD), com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.Currency.CHF));
            IList <Result <object> > expectedCurrencies = ImmutableList.of(Result.success(Currency.CAD), Result.success(Currency.AUD), Result.success(Currency.CHF));

            assertThat(currencyResults).isEqualTo(expectedCurrencies);

            // Amount returns the CurrencyAmount which is slightly unexpected
            // It's required in order to be able to format the amount to the correct number of decimal places
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> amountResults = ValuePathEvaluator.evaluate("Measures.PresentValue.Amount", reportResults);
            IList <Result <object> > amountResults = ValuePathEvaluator.evaluate("Measures.PresentValue.Amount", reportResults);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> expectedAmounts = com.google.common.collect.ImmutableList.of(com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.CurrencyAmount.of(com.opengamma.strata.basics.currency.Currency.CAD, 2d)), com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.CurrencyAmount.of(com.opengamma.strata.basics.currency.Currency.AUD, 3d)), com.opengamma.strata.collect.result.Result.success(com.opengamma.strata.basics.currency.CurrencyAmount.of(com.opengamma.strata.basics.currency.Currency.CHF, 4d)));
            IList <Result <object> > expectedAmounts = ImmutableList.of(Result.success(CurrencyAmount.of(Currency.CAD, 2d)), Result.success(CurrencyAmount.of(Currency.AUD, 3d)), Result.success(CurrencyAmount.of(Currency.CHF, 4d)));

            assertThat(amountResults).isEqualTo(expectedAmounts);
        }