Пример #1
0
        public virtual void test_forecastValue_FxResetNotionalExchange()
        {
            double expected = 0.0123d;
            SwapPaymentEventPricer <FxResetNotionalExchange> mockCalledFn = mock(typeof(SwapPaymentEventPricer));

            when(mockCalledFn.forecastValue(SwapDummyData.FX_RESET_NOTIONAL_EXCHANGE_REC_USD, MOCK_PROV)).thenReturn(expected);
            DispatchingSwapPaymentEventPricer test = new DispatchingSwapPaymentEventPricer(MOCK_NOTIONAL_EXG, mockCalledFn);

            assertEquals(test.forecastValue(SwapDummyData.FX_RESET_NOTIONAL_EXCHANGE_REC_USD, MOCK_PROV), expected, 0d);
        }
Пример #2
0
 //-------------------------------------------------------------------------
 public virtual double forecastValue(SwapPaymentEvent paymentEvent, RatesProvider provider)
 {
     // dispatch by runtime type
     if (paymentEvent is NotionalExchange)
     {
         return(notionalExchangePricer.forecastValue((NotionalExchange)paymentEvent, provider));
     }
     else if (paymentEvent is FxResetNotionalExchange)
     {
         return(fxResetNotionalExchangePricer.forecastValue((FxResetNotionalExchange)paymentEvent, provider));
     }
     else
     {
         throw new System.ArgumentException("Unknown PaymentEvent type: " + paymentEvent.GetType().Name);
     }
 }