Ejemplo n.º 1
0
        public void Coupnum_ShouldReturnNumberOfDays_ActualActual()
        {
            // No need for tests per DayCountBasis here.
            var settlement = new DateTime(2016, 02, 01);
            var maturity   = new DateTime(2019, 3, 15);

            var func = new CoupnumImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.Actual_Actual),
                FinancialDayFactory.Create(maturity, DayCountBasis.Actual_Actual),
                4,
                DayCountBasis.Actual_Actual
                );
            var result = func.GetCoupnum();

            Assert.AreEqual(13d, result.Result);

            settlement = new DateTime(2018, 12, 01);
            maturity   = new DateTime(2019, 5, 31);

            func = new CoupnumImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.Actual_Actual),
                FinancialDayFactory.Create(maturity, DayCountBasis.Actual_Actual),
                2,
                DayCountBasis.Actual_Actual
                );
            result = func.GetCoupnum();
            Assert.AreEqual(1d, result.Result);
        }
Ejemplo n.º 2
0
        protected override FinanceCalcResult <int> ExecuteFunction(FinancialDay settlementDate, FinancialDay maturityDate, int frequency, DayCountBasis basis = DayCountBasis.US_30_360)
        {
            var impl = new CoupnumImpl(settlementDate, maturityDate, frequency, basis);

            return(impl.GetCoupnum());
        }