public void CalculateRemainingInterest_AccrualAccounting() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual); LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true} }; Loan myContract = new Loan(package, 1000, 0.03m, 6, 0, new DateTime(2009, 12, 25), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.Repay(1, new DateTime(2010, 1, 25), 196.67m, false, true); Assert.AreEqual(17.42m, Math.Round(myContract.CalculateRemainingInterests(new DateTime(2010, 2, 12)).Value, 2)); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); }
public void CalculateRemainingInterest_CashAccounting_AfterFirstInstallment() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1 } }; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); Assert.AreEqual(30, Math.Round(myContract.CalculateRemainingInterests(new DateTime(2006, 2, 14)).Value, 2)); }
public void TestCalculateRemainingInterestsWithDateTimeParameter() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.DecliningFixedInstallments, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true} }; Loan myContract = new Loan(package,750,0.03m,9,1,new DateTime(2006,6,22), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); Assert.AreEqual(46.5m, Math.Round(myContract.CalculateRemainingInterests(new DateTime(2006, 8, 22)).Value, 2)); }
public void TestCalculateRemainingInterests() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true); LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1 } }; Loan myContract = new Loan(package, 1000, 0.02m, 6, 1, new DateTime(2006, 1, 2), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.Repay(1, new DateTime(2006, 2, 2), 20, false, false); Assert.AreEqual(100m, myContract.CalculateRemainingInterests().Value); }