コード例 #1
0
        public void TestCalculatePendingRepayment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                KeepExpectedInstallment = false,
                Currency = new Currency { Id = 1 }
            };
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 2, new DateTime(2006, 1, 1), new User(),
                                       ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                                       ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            PaymentMethod paymentMethod = new PaymentMethod(2, "Voucher", "", true);
            RepaymentEvent pEvent = myContract.Repay(1, new DateTime(2006, 6, 1), 30, true, 0, 0, false, 0, true, false, true,
                                                     paymentMethod);

            Assert.IsTrue(myContract.GetInstallment(0).IsRepaid);
            Assert.AreEqual(pEvent.Code, "PBLR");
            Assert.IsTrue(myContract.GetInstallment(0).IsPending);
            myContract.ConfirmPendingRepayment();
            Assert.IsFalse(myContract.GetInstallment(0).IsPending);
        }