//-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            CurrencyAmount computed   = PRICER.presentValue(TRADE, RATES_PROVIDER, PriceType.CLEAN, REF_DATA);
            CurrencyAmount expected   = PRICER_PRODUCT.presentValue(PRODUCT, RATES_PROVIDER, VALUATION_DATE, PriceType.CLEAN, REF_DATA).plus(PRICER_PAYMENT.presentValue(UPFRONT, YIELD_CRVE.toDiscountFactors()));
            CurrencyAmount computedMf = PRICER_MF.presentValue(TRADE_NO_SETTLE_DATE, RATES_PROVIDER, PriceType.CLEAN, REF_DATA);
            CurrencyAmount expectedMf = PRICER_PRODUCT_MF.presentValue(PRODUCT, RATES_PROVIDER, VALUATION_DATE, PriceType.CLEAN, REF_DATA);

            assertEquals(computed.Amount, expected.Amount, TOL);
            assertEquals(computedMf.Amount, expectedMf.Amount, TOL);
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value of the trade.
        /// <para>
        /// The present value of the product is based on the valuation date.
        /// </para>
        /// <para>
        /// This method can calculate the clean or dirty present value, see <seealso cref="PriceType"/>.
        /// If calculating the clean value, the accrued interest is calculated based on the step-in date.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="priceType">  the price type </param>
        /// <param name="refData">  the reference data </param>
        /// <returns> the price </returns>
        public virtual CurrencyAmount presentValue(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, PriceType priceType, ReferenceData refData)
        {
            CurrencyAmount pvProduct = productPricer.presentValue(trade.Product, ratesProvider, ratesProvider.ValuationDate, priceType, refData);

            if (!trade.UpfrontFee.Present)
            {
                return(pvProduct);
            }
            Payment        upfront   = trade.UpfrontFee.get();
            CurrencyAmount pvUpfront = upfrontPricer.presentValue(upfront, ratesProvider.discountFactors(upfront.Currency).toDiscountFactors());

            return(pvProduct.plus(pvUpfront));
        }