Exemplo n.º 1
0
        public void Test_RescheduleLateLoanProcessing()
        {
            Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6);

            OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI =
                _SetRepaymentOptions(myContract, false);

            Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate);

            myContract.Repay(1, new DateTime(2010, 7, 6), 230, false, true);
            myContract.Repay(2, new DateTime(2010, 8, 6), 230, false, true);

            rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1));
            ReschedulingOptions ro = new ReschedulingOptions
            {
                InterestRate              = 0.04m,
                NewInstallments           = 2,
                RepaymentDateOffset       = 0,
                ChargeInterestDuringShift = true,
                ReschedulingDate          = new DateTime(2010, 10, 1)
            };

            myContract.Reschedule(ro);
            myContract.AddRecheduleTransformationEvent(ro.ReschedulingDate);
            List <OverdueEvent> list = myContract.Events.GetOverdueEvents();

            Assert.AreEqual(list[0].Code, "LLRL");

            // good loan to the bad loan
            OverdueEvent e = myContract.GetOverdueEvent(new DateTime(2010, 10, 1));

            Assert.AreEqual(e.Code, "GLLL");
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 20));
            Assert.AreEqual(e, null);
            myContract.Repay(1, new DateTime(2010, 10, 20), 500, false, true);
            //bad loan to the late loan
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 21));

            Assert.AreEqual(e.Code, "LLGL");
            myContract.Repay(1, new DateTime(2010, 11, 6), 500, false, true);
            //late loan to the good loan
        }