Esempio n. 1
0
        //-------------------------------------------------------------------------
        public virtual void test_currentCash_RatePaymentPeriod()
        {
            double expected = 0.0123d;
            SwapPaymentPeriodPricer <RatePaymentPeriod> mockNotionalExchangeFn = mock(typeof(SwapPaymentPeriodPricer));

            when(mockNotionalExchangeFn.currentCash(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV)).thenReturn(expected);
            DispatchingSwapPaymentPeriodPricer test = new DispatchingSwapPaymentPeriodPricer(mockNotionalExchangeFn, MOCK_KNOWN);

            assertEquals(test.currentCash(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV), expected, 0d);
        }
Esempio n. 2
0
 public virtual double currentCash(SwapPaymentPeriod paymentPeriod, RatesProvider provider)
 {
     // dispatch by runtime type
     if (paymentPeriod is RatePaymentPeriod)
     {
         return(ratePaymentPeriodPricer.currentCash((RatePaymentPeriod)paymentPeriod, provider));
     }
     else if (paymentPeriod is KnownAmountSwapPaymentPeriod)
     {
         return(knownAmountPaymentPeriodPricer.currentCash((KnownAmountSwapPaymentPeriod)paymentPeriod, provider));
     }
     else
     {
         throw new System.ArgumentException("Unknown PaymentEvent type: " + paymentPeriod.GetType().Name);
     }
 }