Пример #1
0
        public void CalculateWithDownPaymentAndOneOverPaymentTest()
        {
            AddReceipt(60M, Layaway.DateMade, ReceiptEventTypes.LAYPMT, "98581", "97907", new DateTime(2011, 2, 8, 14, 38, 50));

            Builder         = new LayawayPaymentHistoryBuilder();
            Builder.Layaway = Layaway;
            Builder.Calculate();

            // Need to account for the down payment
            Assert.AreEqual(Layaway.NumberOfPayments + 1, Builder.ScheduledPayments.Count);

            // Is the first payment the downpayment
            Assert.AreEqual(1, Builder.ScheduledPayments[0].Payments.Count);
            Assert.IsTrue(Builder.ScheduledPayments[0].IsPaid());

            Assert.AreEqual(1, Builder.ScheduledPayments[1].Payments.Count);
            Assert.AreEqual(Layaway.MonthlyPayment, Builder.ScheduledPayments[1].Payments[0].PaymentAmountMade);
            Assert.AreEqual(0M, Builder.ScheduledPayments[1].GetRemainingBalance());
            Assert.IsTrue(Builder.ScheduledPayments[1].IsPaid());

            Assert.AreEqual(1, Builder.ScheduledPayments[2].Payments.Count);
            Assert.AreEqual(Layaway.MonthlyPayment, Builder.ScheduledPayments[2].Payments[0].PaymentAmountMade);
            Assert.AreEqual(0M, Builder.ScheduledPayments[2].GetRemainingBalance());
            Assert.IsTrue(Builder.ScheduledPayments[2].IsPaid());

            Assert.AreEqual(1, Builder.ScheduledPayments[3].Payments.Count);
            Assert.AreEqual(9.9M, Builder.ScheduledPayments[3].Payments[0].PaymentAmountMade);
            Assert.AreEqual(15.15M, Builder.ScheduledPayments[3].GetRemainingBalance());
            Assert.IsFalse(Builder.ScheduledPayments[3].IsPaid());
        }
Пример #2
0
        public void InitialLayawayCalculateWithDownPaymentTest()
        {
            Builder         = new LayawayPaymentHistoryBuilder();
            Builder.Layaway = Layaway;
            Builder.Calculate();

            // Need to account for the down payment
            Assert.AreEqual(Layaway.NumberOfPayments + 1, Builder.ScheduledPayments.Count);

            // Is the first payment the downpayment
            Assert.AreEqual(1, Builder.ScheduledPayments[0].Payments.Count);
            Assert.IsTrue(Builder.ScheduledPayments[0].IsPaid());
        }