public virtual void test_of_All()
        {
            CalculationRules test = CalculationRules.of(FUNCTIONS, ReportingCurrency.of(USD), CalculationParameters.of(PARAM));

            assertEquals(test.Functions, FUNCTIONS);
            assertEquals(test.ReportingCurrency, ReportingCurrency.of(USD));
            assertEquals(test.Parameters, CalculationParameters.of(PARAM));
        }
        public virtual void test_of_MeasureCurrencyCalculationParameters()
        {
            Column test = Column.of(TestingMeasures.PRESENT_VALUE, USD, PARAM);

            assertEquals(test.Name, ColumnName.of(TestingMeasures.PRESENT_VALUE.Name));
            assertEquals(test.Measure, TestingMeasures.PRESENT_VALUE);
            assertEquals(test.ReportingCurrency, ReportingCurrency.of(USD));
            assertEquals(test.Parameters, CalculationParameters.of(PARAM));
        }
        public virtual void test_of_MeasureStringCurrency()
        {
            Column test = Column.of(TestingMeasures.PRESENT_VALUE, "NPV", USD);

            assertEquals(test.Name, ColumnName.of("NPV"));
            assertEquals(test.Measure, TestingMeasures.PRESENT_VALUE);
            assertEquals(test.ReportingCurrency, ReportingCurrency.of(USD));
            assertEquals(test.Parameters, CalculationParameters.empty());
        }
Beispiel #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ReportingCurrency test = ReportingCurrency.NATURAL;

            coverImmutableBean(test);
            ReportingCurrency test2 = ReportingCurrency.of(USD);

            coverBeanEquals(test, test2);
            coverEnum(typeof(ReportingCurrencyType));
        }
Beispiel #5
0
        public virtual void test_of_specific()
        {
            ReportingCurrency test = ReportingCurrency.of(USD);

            assertEquals(test.Type, ReportingCurrencyType.SPECIFIC);
            assertEquals(test.Specific, true);
            assertEquals(test.Natural, false);
            assertEquals(test.None, false);
            assertEquals(test.Currency, USD);
            assertEquals(test.ToString(), "Specific:USD");
        }
Beispiel #6
0
        /// <summary>
        /// Obtains an instance that will calculate the specified measure, converting to the specified currency,
        /// defining the column name and parameters.
        /// <para>
        /// The specified calculation parameters take precedence over those in <seealso cref="CalculationRules"/>,
        /// with the combined set being used for the column.
        ///
        /// </para>
        /// </summary>
        /// <param name="measure">  the measure to be calculated </param>
        /// <param name="columnName">  the column name </param>
        /// <param name="currency">  the currency to convert to </param>
        /// <param name="parameters">  the parameters that control the calculation, may be empty </param>
        /// <returns> a column with the specified measure, column name and reporting currency </returns>
        public static Column of(Measure measure, string columnName, Currency currency, params CalculationParameter[] parameters)
        {
            ColumnName name = ColumnName.of(columnName);

            return(new Column(name, measure, ReportingCurrency.of(currency), CalculationParameters.of(parameters)));
        }
Beispiel #7
0
        /// <summary>
        /// Obtains an instance that will calculate the specified measure, converting to the specified currency.
        /// <para>
        /// The column name will be the same as the name of the measure.
        ///
        /// </para>
        /// </summary>
        /// <param name="measure">  the measure to be calculated </param>
        /// <param name="currency">  the currency to convert to </param>
        /// <returns> a column with the specified measure </returns>
        public static Column of(Measure measure, Currency currency)
        {
            ColumnName name = ColumnName.of(measure);

            return(new Column(name, measure, ReportingCurrency.of(currency), CalculationParameters.empty()));
        }
Beispiel #8
0
 public virtual void test_serialization()
 {
     assertSerialization(ReportingCurrency.NATURAL);
     assertSerialization(ReportingCurrency.of(USD));
 }
        /// <summary>
        /// Obtains an instance specifying the functions, reporting currency and additional parameters.
        /// <para>
        /// Most functions require a parameter to control their behavior, such as {@code RatesMarketDataLookup}.
        ///
        /// </para>
        /// </summary>
        /// <param name="functions">  the calculation functions </param>
        /// <param name="reportingCurrency">  the reporting currency </param>
        /// <param name="parameters">  the parameters that control the calculation, may be empty </param>
        /// <returns> the rules </returns>
        public static CalculationRules of(CalculationFunctions functions, Currency reportingCurrency, params CalculationParameter[] parameters)
        {
            CalculationParameters @params = CalculationParameters.of(parameters);

            return(new CalculationRules(functions, ReportingCurrency.of(reportingCurrency), @params));
        }