public void GetNextBillingDate_ComparisonAfterBillingDay_AND_ComparisonDayIsInDecember_DateIsNextYear() { var compTime = new DateTime(2012, 12, 17); var billingDay = 15; var sd = new SubscriptionDetail() { BillingDay = billingDay }; Company newCompany = new Company() { Name = "Random" }; newCompany.Invoices.Add(new Invoice() { DateCreated = compTime.Subtract(new TimeSpan(35, 0, 0, 0)), AutoGenerated = true }); sd.Companies.Add(newCompany); var nextBillingDate = sd.GetNextBillingDate(compTime); var expectedBillingDate = new DateTime(2013,01,billingDay); Assert.AreEqual(expectedBillingDate.Date, nextBillingDate.Date); }
public void GetNextBillingDate_ComparisonOnBillingDay_AND_AutoInvoiceOnThisDay_DateIsNextMonth() { var compTime = new DateTime(2012, 01, 15); var billingDay = 15; var sd = new SubscriptionDetail() { BillingDay = billingDay }; Company newCompany = new Company() { Name = "Random" }; newCompany.Invoices.Add(new Invoice() {DateCreated = compTime, AutoGenerated=true }); newCompany.Invoices.Add(new Invoice() { DateCreated = compTime.Subtract(new TimeSpan(35,0,0,0)), AutoGenerated = true }); sd.Companies.Add(newCompany); var nextBillingDate = sd.GetNextBillingDate(compTime); var expectedBillingDate = new DateTime(2012,02,billingDay); Assert.AreEqual(expectedBillingDate.Date, nextBillingDate.Date); }