public void Can_calculate_nextPaymentDate_with_days_as_cycle_period() { var rp = new RecurringPayment { Id = 1, CycleLength = 7, CyclePeriod = RecurringProductCyclePeriod.Days, TotalCycles = 3, StartDateUtc = new DateTime(2010, 3, 1), CreatedOnUtc = new DateTime(2010, 1, 1), IsActive = true, }; _orderService.InsertRecurringPayment(rp); _orderProcessingService.GetNextPaymentDate(rp).Should().Be(new DateTime(2010, 3, 1)); //add one history record _orderService.InsertRecurringPaymentHistory(new RecurringPaymentHistory { RecurringPaymentId = rp.Id }); _orderProcessingService.GetNextPaymentDate(rp).Should().Be(new DateTime(2010, 3, 8)); //add one more history record _orderService.InsertRecurringPaymentHistory(new RecurringPaymentHistory { RecurringPaymentId = rp.Id }); _orderProcessingService.GetNextPaymentDate(rp).Should().Be(new DateTime(2010, 3, 15)); //add one more history record _orderService.InsertRecurringPaymentHistory(new RecurringPaymentHistory { RecurringPaymentId = rp.Id }); _orderProcessingService.GetNextPaymentDate(rp).Should().BeNull(); }