public void CheckSumOfInterestAndPrincipal_InterestCoefEgal100_PrincipalCoeffEgal10() { ExoticInstallment exoticInstallment1 = new ExoticInstallment(); exoticInstallment1.InterestCoeff = 70; exoticInstallment1.PrincipalCoeff = 0; ExoticInstallment exoticInstallment2 = new ExoticInstallment(); exoticInstallment2.InterestCoeff = 30; exoticInstallment2.PrincipalCoeff = 10; ExoticInstallmentsTable product = new ExoticInstallmentsTable(); product.Add(exoticInstallment1); product.Add(exoticInstallment2); Assert.IsFalse(product.CheckIfSumIsOk(OLoanTypes.Flat)); }
public int AddExoticProduct(ExoticInstallmentsTable pExoticProduct, OLoanTypes loanType) { if (_productManager.IsThisExoticProductNameAlreadyExist(pExoticProduct.Name)) throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.ExoticProductNameAlreadyExist); if(!pExoticProduct.CheckIfSumIsOk(loanType)) throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.ExoticProductSumInIncorrect); pExoticProduct.Id = _productManager.AddExoticInstallmentsTable(pExoticProduct); foreach (ExoticInstallment installment in pExoticProduct) { _productManager.AddExoticInstallment(installment, pExoticProduct); } return pExoticProduct.Id; }
public void TestSumForDecliningInterestRateType() { var i1 = new ExoticInstallment() {PrincipalCoeff = 0.7, InterestCoeff = 0}; var i2 = new ExoticInstallment() {PrincipalCoeff = 0.3, InterestCoeff = 0}; var exotic = new ExoticInstallmentsTable(); exotic.Add(i1); exotic.Add(i2); Assert.IsTrue(exotic.CheckIfSumIsOk(OLoanTypes.DecliningFixedPrincipal)); }