public void CheckDueDate(Invoice invoiceContainingTheBill, Bill billToCheck, DateTime todayDate) { bool itWasToCollect = billToCheck.PaymentResult == Bill.BillPaymentResult.ToCollect; billToCheck.CheckDueDate(todayDate); bool itIsUnpaid = billToCheck.PaymentResult == Bill.BillPaymentResult.Unpaid; if (itWasToCollect && itIsUnpaid) invoiceContainingTheBill.SetInvoiceAsUnpaid(); }
public void WhenIRenewTheDueDateOfAPastDueDateBillTheBillIsSetAgainToToCollect() { Bill bill = new Bill("MMM201300015/001", "This bill is past due date", 1, new DateTime(2013, 11, 11), new DateTime(2013, 11, 15)); DateTime newDueDate = new DateTime(2013, 11, 30); DateTime todayDate = new DateTime(2013, 11, 20); bill.CheckDueDate(todayDate); Assert.AreEqual(Bill.BillPaymentResult.Unpaid, bill.PaymentResult); bill.RenewDueDate(newDueDate, todayDate); Assert.AreEqual(Bill.BillPaymentResult.ToCollect, bill.PaymentResult); }
public void ABillPastDueDateIsMarkedAsUnpaid() { Bill bill = new Bill("MMM201300015/001", "This bill is past due date", 1, new DateTime(2013, 11, 11), new DateTime(2013, 11, 15)); Assert.AreEqual(Bill.BillPaymentResult.ToCollect, bill.PaymentResult); bill.CheckDueDate(new DateTime(2013,11,30)); Assert.AreEqual(Bill.BillPaymentResult.Unpaid, bill.PaymentResult); }
public void IfTheBillIsNotPastDueDateItKeepsToCollect() { Bill bill = new Bill("MMM201300015/001", "This bill is not past due date", 1, new DateTime(2013, 11, 01), new DateTime(2013, 12, 01)); Assert.AreEqual(Bill.BillPaymentResult.ToCollect, bill.PaymentResult); bill.CheckDueDate(new DateTime(2013, 11, 30)); Assert.AreEqual(Bill.BillPaymentResult.ToCollect, bill.PaymentResult); }