Exemplo n.º 1
0
        public void Couppcd_ShouldReturnCorrectDate_ActualActual()
        {
            // No need for tests per DayCountBasis here.
            var settlement = new DateTime(2017, 05, 30);
            var maturity   = new DateTime(2020, 05, 31);

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

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

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

            func = new CouppcdImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.Actual_Actual),
                FinancialDayFactory.Create(maturity, DayCountBasis.Actual_Actual),
                4,
                DayCountBasis.Actual_Actual
                );
            result = func.GetCouppcd();
            Assert.AreEqual(new System.DateTime(2015, 11, 30), result.Result);
        }
Exemplo n.º 2
0
        protected override FinanceCalcResult <System.DateTime> ExecuteFunction(FinancialDay settlementDate, FinancialDay maturityDate, int frequency, DayCountBasis basis = DayCountBasis.US_30_360)
        {
            var impl = new CouppcdImpl(settlementDate, maturityDate, frequency, basis);

            return(impl.GetCouppcd());
        }