public void TestIfDistrictCorrectlyRetrievedWhenContractBeneficiaryIsAGroup() { CashReceipt cashReceipt = new CashReceipt(contractForAGroup, _group, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Lorraine", cashReceipt.District); }
public void TestSelectAllParameters() { generalSettingsManager.FillGeneralSettings(); GeneralSettings dataParam = GeneralSettings.GetInstance(""); Assert.AreEqual(29, dataParam.DbParamList.Count); }
public void TestIfUserIdCorrectlySaveAndRetrieved() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.UserId); }
public void TestIfLoanOfficerNameCorrectlyRetrieved() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Nicolas MANGIN", cashReceipt.LoanOfficerName_Contract); }
public void TestIfCityCorrectlyRetrievedWhenContractBeneficiaryIsAPerson() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Paris", cashReceipt.City); }
public void TestUpdateExternalCurrencyWhenNull() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.EXTERNALCURRENCY, null); Assert.AreEqual(null, dataParam.ExternalCurrency); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(null, dataParam.ExternalCurrency); }
public void TestUpdateCountry() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.COUNTRY, "FRANCE"); Assert.AreEqual("FRANCE", dataParam.Country); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("FRANCE", dataParam.Country); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.COUNTRY, "AGHANISTAN"); Assert.AreEqual("AGHANISTAN", dataParam.Country); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("AGHANISTAN", dataParam.Country); }
public void TestUpdatePayFirstInstallmentRealValue() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, true); Assert.AreEqual(true, dataParam.PayFirstInterestRealValue); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.PayFirstInterestRealValue); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, false); Assert.AreEqual(false, dataParam.PayFirstInterestRealValue); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.PayFirstInterestRealValue); }
public void TestUpdateBranchCode() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.BRANCHCODE, "KT"); Assert.AreEqual("KT", dataParam.BranchCode); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("KT", dataParam.BranchCode); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.BRANCHCODE, "FR"); Assert.AreEqual("FR", dataParam.BranchCode); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("FR", dataParam.BranchCode); }
public void TestUpdateGroupMinMembers() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.GROUPMINMEMBERS, 2); Assert.AreEqual(2, dataParam.GroupMinMembers); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(2, dataParam.GroupMinMembers); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.GROUPMINMEMBERS, 5); Assert.AreEqual(5, dataParam.GroupMinMembers); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(5, dataParam.GroupMinMembers); }
public void TestUpdateCityMandatory() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CITYMANDATORY, true); Assert.AreEqual(true, dataParam.IsCityMandatory); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.IsCityMandatory); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CITYMANDATORY, false); Assert.AreEqual(false, dataParam.IsCityMandatory); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.IsCityMandatory); }
public void TestUpdateLoanOfficerPortfolioFilter() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.LOANOFFICERPORTFOLIOFILTER, true); Assert.AreEqual(true, dataParam.IsLoanOfficerPortfolioActive); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.IsLoanOfficerPortfolioActive); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.LOANOFFICERPORTFOLIOFILTER, false); Assert.AreEqual(false, dataParam.IsLoanOfficerPortfolioActive); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.IsLoanOfficerPortfolioActive); }
public void TestUpdateCityOpenValue() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CITYOPENVALUE, true); Assert.AreEqual(true, dataParam.IsCityAnOpenValue); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.IsCityAnOpenValue); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CITYOPENVALUE, false); Assert.AreEqual(false, dataParam.IsCityAnOpenValue); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.IsCityAnOpenValue); }
public void TestUpdateGroupCashReceipts() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.GROUPEDCASHRECEIPTS, true); Assert.AreEqual(true, dataParam.IsCashReceiptsGrouped); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.IsCashReceiptsGrouped); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.GROUPEDCASHRECEIPTS, false); Assert.AreEqual(false, dataParam.IsCashReceiptsGrouped); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.IsCashReceiptsGrouped); }
public void TestUpdateCashReceiptBeforeConfirmation() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CASHRECEIPTBEFORECONFIRMATION, true); Assert.AreEqual(true, dataParam.IsCashReceiptBeforeConfirmation); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(true, dataParam.IsCashReceiptBeforeConfirmation); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.CASHRECEIPTBEFORECONFIRMATION, false); Assert.AreEqual(false, dataParam.IsCashReceiptBeforeConfirmation); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(false, dataParam.IsCashReceiptBeforeConfirmation); }
public void TestUpdateInternalCurrency() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.INTERNALCURRENCY, "SOM"); Assert.AreEqual("SOM", dataParam.InternalCurrency); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("SOM", dataParam.InternalCurrency); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.INTERNALCURRENCY, "USD"); Assert.AreEqual("USD", dataParam.InternalCurrency); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual("USD", dataParam.InternalCurrency); }
public void TestUpdateWeekEndDay2() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.WEEKENDDAY2, 2); Assert.AreEqual(2, dataParam.WeekEndDay2); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(2, dataParam.WeekEndDay2); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.WEEKENDDAY2, 5); Assert.AreEqual(5, dataParam.WeekEndDay2); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(5, dataParam.WeekEndDay2); }
public void TestUpdateWeekEndDay1() { GeneralSettings dataParam = GeneralSettings.GetInstance(""); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.WEEKENDDAY1, 1); Assert.AreEqual(1, dataParam.WeekEndDay1); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(1, dataParam.WeekEndDay1); generalSettingsManager.UpdateSelectedParameter(OGeneralSettings.WEEKENDDAY1, 4); Assert.AreEqual(4, dataParam.WeekEndDay1); generalSettingsManager.FillGeneralSettings(); Assert.AreEqual(4, dataParam.WeekEndDay1); }
private static Credit _AddCredit() { GeneralSettings.GetInstance("").DeleteAllParameters(); GeneralSettings.GetInstance("").AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); GeneralSettings.GetInstance("").AddParameter(OGeneralSettings.USECENTS, true); FundingLineManager _fundingLineManager = new FundingLineManager(DataUtil.TESTDB); FundingLine fund = new FundingLine(); fund.Purpose = "Microsoft financement"; fund.Name = "AFD130"; fund.Deleted = false; fund.StartDate = DateTime.Now; fund.EndDate = DateTime.Now; _fundingLineManager.AddFundingLine(fund, null); Package _package = new Package(); _package.Name = "Package"; _package.Delete = false; _package.LoanType = OLoanTypes.Flat; _package.ClientType = 'G'; _package.ChargeInterestWithinGracePeriod = true; _package.InstallmentType = new DataHelper().AddBiWeeklyInstallmentType(); _package.FundingLine = fund; _package.Id = new ProductManager(DataUtil.TESTDB).AddPackage(_package); User user = new User(); user.Id = new DataHelper().AddUserWithIntermediaryAttributs(); Credit credit = new Credit(_package, 1000, 3, 6, 0, new DateTime(2006, 1, 1), user, GeneralSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(user)); credit.CreationDate = DateTime.Today.AddDays(-1); credit.StartDate = DateTime.Today; credit.LoanOfficer = user; credit.CloseDate = DateTime.Today.AddDays(1); credit.BranchCode = "CA"; credit.FundingLine = fund; //new DataHelper().AddGenericFundingLine(); credit.Code = "TEST"; return(credit); }
public void TestFixtureSetUp() { User.CurrentUser = new User(); User.CurrentUser.Id = 1; GeneralSettings dataParam = GeneralSettings.GetInstance(""); dataParam.DeleteAllParameters(); dataParam.AddParameter(OGeneralSettings.USECENTS, true); ChartOfAccounts chartOfAccounts = ChartOfAccounts.GetInstance(User.CurrentUser); chartOfAccounts.Accounts = chartOfAccounts.DefaultAccounts; ProvisioningTable provisioningTable = ProvisioningTable.GetInstance(User.CurrentUser); provisioningTable.AddProvisioningRate(new ProvisioningRate(1, 0, 0, 2)); }
public void TestIfInterestPrincipalAndFeesCorrectlyRetrievedWhenRepayAndFees() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); Assert.AreEqual(new DateTime(2006, 2, 1), contract.GetInstallment(0).ExpectedDate); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); }
public void TestIfLocalAccountNumberCorrectlyRetrievedWhenRepayAGoodLoan() { ChartOfAccounts chartOfAccounts = ChartOfAccounts.GetInstance(User.CurrentUser); Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(chartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_CASH_CREDIT_INDIVIDUAL_LOAN).LocalNumber, cashReceipt.InterestLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByNumber(OAccounts.CASH_CREDIT_INDIVIDUAL_LOAN).LocalNumber, cashReceipt.PrincipalLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("COMMISSIONS").LocalNumber, cashReceipt.FeesLocalAccountNumber); }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenDisburseAndNoFeesWhenCurrencyIsSOMAndLanguageIsRussian() { Assert.AreEqual(new DateTime(2006, 1, 1), contractForAPerson.StartDate); CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "SOM", "ru-RU", new ExchangeRate(new DateTime(2006, 1, 1), 3), new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); //Negative value for principal if event is a loanDisbursmentEvent Assert.AreEqual(-3000, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidFeesInExternalCurrency); Assert.AreEqual("ноль SOM", cashReceipt.PaidInterestInLetter); Assert.AreEqual("ноль SOM", cashReceipt.PaidFeesInLetter); Assert.AreEqual("три тысячи SOM", cashReceipt.PaidPrincipalInLetter); }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenRepayAndFeesWhenCurrencyIsUSDAndLanguageIsEnglish() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); Assert.AreEqual("ninety USD", cashReceipt.PaidInterestInLetter); Assert.AreEqual("two hundred and fifty-two USD", cashReceipt.PaidFeesInLetter); Assert.AreEqual("zero USD", cashReceipt.PaidPrincipalInLetter); }
public void CashReceipt_CorrectlySaveAndRetrieved_GracePeriod() { contractForAPerson.Disbursed = true; _person.CashReceiptIn = 1; CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.GracePeriod); }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenRepayAndFeesWhenCurrencyIsUSDAndLanguageIsRussian() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "ru-RU", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); Assert.AreEqual("девяносто USD", cashReceipt.PaidInterestInLetter); Assert.AreEqual("двести пятьдесят два USD", cashReceipt.PaidFeesInLetter); Assert.AreEqual("ноль USD", cashReceipt.PaidPrincipalInLetter); }
public void SetUp() { Package package = new Package(new InstallmentType(1, "Monthly", 0, 1), OLoanTypes.Flat, true); package.KeepExpectedInstallment = true; package.NonRepaymentPenalties.InitialAmount = 0.003; contractForAPerson = new Credit(package, 1000, 0.03, 6, 1, new DateTime(2006, 1, 1), User.CurrentUser, GeneralSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(User.CurrentUser)); contractForAPerson.NonRepaymentPenalties.InitialAmount = 0.003; _person = new Person(); _person.FirstName = "Nicolas"; _person.LastName = "MANGIN"; _person.District = new District(1, "Ile de France", new Province(1, "France")); _person.City = "Paris"; User user = User.CurrentUser; user.FirstName = "Nicolas"; user.LastName = "MANGIN"; contractForAPerson.LoanOfficer = user; contractForAGroup = new Credit(package, 1000, 0.03, 6, 1, new DateTime(2006, 1, 1), User.CurrentUser, GeneralSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(User.CurrentUser)); _group = new Group(); _group.Name = "Groupe MANGIN"; _group.District = new District(1, "Lorraine", new Province(1, "France")); _group.City = "Nancy"; contractForAGroup.EntryFees = 0.03; }
public void TestIfInterestPrincipalAndFeesCorrectlyRetrievedWhenDisburseAndFees() { Assert.AreEqual(new DateTime(2006, 1, 1), contractForAGroup.StartDate); CashReceipt cashReceipt = new CashReceipt(contractForAGroup, _person, null, "USD", "en-US", new ExchangeRate(new DateTime(2006, 1, 1), 3), new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); //Negative value for principal if event is a loanDisbursmentEvent Assert.AreEqual(-3000, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidFeesInExternalCurrency); }
public void TestIfCashReceiptOutCorrectlySaveAndRetrievedWhenNoCashReceiptOut() { contractForAPerson.Disbursed = false; CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.CashReceiptOut.Value); }
public void TestIfLocalAccountNumberCorrectlyRetrievedWhenDisburse() { ChartOfAccounts chartOfAccounts = ChartOfAccounts.GetInstance(User.CurrentUser); CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "USD", "en-US", null, new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(String.Empty, cashReceipt.InterestLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("CASH").LocalNumber, cashReceipt.PrincipalLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("COMMISSIONS").LocalNumber, cashReceipt.FeesLocalAccountNumber); }