예제 #1
0
        public void Coupncd_ShouldReturnCorrectDate_ActualActual()
        {
            // No need for tests per DayCountBasis here.
            var settlement = new DateTime(2017, 02, 01);
            var maturity   = new DateTime(2020, 05, 31);

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

            Assert.AreEqual(new System.DateTime(2017, 2, 28), result.Result);

            settlement = new DateTime(2016, 02, 01);
            maturity   = new DateTime(2019, 5, 31);

            func = new CoupncdImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.Actual_Actual),
                FinancialDayFactory.Create(maturity, DayCountBasis.Actual_Actual),
                4,
                DayCountBasis.Actual_Actual
                );
            result = func.GetCoupncd();
            Assert.AreEqual(new System.DateTime(2016, 2, 29), result.Result);
        }
예제 #2
0
        protected override FinanceCalcResult <System.DateTime> ExecuteFunction(FinancialDay settlementDate, FinancialDay maturityDate, int frequency, DayCountBasis basis = DayCountBasis.US_30_360)
        {
            var impl = new CoupncdImpl(settlementDate, maturityDate, frequency, basis);

            return(impl.GetCoupncd());
        }