public void ShortInitialStubSpecified()
        {
            DateTime                   startDate              = new DateTime(2007, 01, 5);
            DateTime                   endDate                = new DateTime(2012, 01, 5);
            RollConventionEnum         rollConvention         = RollConventionEnum.Item26;
            CalculationPeriodFrequency periodFrequency        = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            DateTime                   firstRegularPeriodDate = new DateTime(2007, 1, 26);
            CalculationPeriodSchedule  cps = new CalculationPeriodSchedule();
            List <CalculationPeriod>   unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateSchedule(startDate, endDate, firstRegularPeriodDate, periodFrequency, StubPeriodTypeEnum.ShortInitial);

            Assert.AreEqual(unadjustedCalcPeriods.Count, 21);
            Assert.IsTrue(cps.HasFinalStub);
            Assert.IsTrue(cps.HasInitialStub);
            Assert.IsTrue(CalculationPeriodHelper.IsShortStub(unadjustedCalcPeriods[0], cps.PeriodInterval));
        }
        public void ShortFinalStubSpecifiedFromTermination()
        {
            DateTime                   startDate       = new DateTime(2007, 01, 5);
            DateTime                   endDate         = new DateTime(2010, 01, 5);
            RollConventionEnum         rollConvention  = RollConventionEnum.Item12;
            CalculationPeriodFrequency periodFrequency = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            Period periodInterval             = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency);
            CalculationPeriodSchedule cps     = new CalculationPeriodSchedule();
            DateTime lastRegularPeriodEndDate = new DateTime(2009, 8, 12);
            List <CalculationPeriod> unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateScheduleFromTermDate(startDate, endDate, periodInterval, lastRegularPeriodEndDate, rollConvention, StubPeriodTypeEnum.ShortFinal);

            Assert.AreEqual(unadjustedCalcPeriods.Count, 13);
            Assert.IsTrue(cps.HasFinalStub);
            Assert.IsTrue(cps.HasInitialStub);
            Assert.IsTrue(CalculationPeriodHelper.IsShortStub(unadjustedCalcPeriods[unadjustedCalcPeriods.Count - 1], cps.PeriodInterval));
        }