public static CertificateOfDeposit registerFor(double value, int numberOfDays, double tna, ReceptiveAccount account) { CertificateOfDeposit certificadoDeDeposito = new CertificateOfDeposit(value, numberOfDays, tna); account.register(certificadoDeDeposito); return(certificadoDeDeposito); }
public void test23ShouldBeAbleToQueryInvestmentEarnings() { ReceptiveAccount account = new ReceptiveAccount(); CertificateOfDeposit.registerFor(100, 30, 0.1, account); CertificateOfDeposit.registerFor(100, 60, 0.15, account); double m_investmentEarnings = 100.0 * (0.1 / 360) * 30 + 100.0 * (0.15 / 360) * 60; Assert.AreEqual(m_investmentEarnings, investmentEarnings(account)); }
public void test22CertificateOfDepositShouldWithdrawInvestmentValue() { ReceptiveAccount account = new ReceptiveAccount(); ReceptiveAccount toAccount = new ReceptiveAccount(); Deposit.registerForOn(1000, account); Withdraw.registerForOn(50, account); Transfer.registerFor(100, account, toAccount); CertificateOfDeposit.registerFor(100, 30, 0.1, account); Assert.AreEqual(100.0, investmentNet(account)); Assert.AreEqual(750.0, account.balance()); }
public void test25ShouldBeAbleToBeQueryTransferNetWithCertificateOfDeposit() { ReceptiveAccount fromAccount = new ReceptiveAccount(); ReceptiveAccount toAccount = new ReceptiveAccount(); Deposit.registerForOn(100, fromAccount); Withdraw.registerForOn(50, fromAccount); Transfer.registerFor(100, fromAccount, toAccount); Transfer.registerFor(250, toAccount, fromAccount); CertificateOfDeposit.registerFor(1000, 30, 0.1, fromAccount); Assert.AreEqual(150.0, accountTransferNet(fromAccount)); Assert.AreEqual(-150.0, accountTransferNet(toAccount)); }
public void test24AccountSummaryShouldWorkWithCertificateOfDeposit() { ReceptiveAccount fromAccount = new ReceptiveAccount(); ReceptiveAccount toAccount = new ReceptiveAccount(); Deposit.registerForOn(100, fromAccount); Withdraw.registerForOn(50, fromAccount); Transfer.registerFor(100, fromAccount, toAccount); CertificateOfDeposit.registerFor(1000, 30, 0.1, fromAccount); List <String> lines = accountSummaryLines(fromAccount); Assert.AreEqual(4, lines.Count); Assert.AreEqual("Depósito por 100.0", lines.ElementAt(0)); Assert.AreEqual("Extracción por 50.0", lines.ElementAt(1)); Assert.AreEqual("Transferencia por -100.0", lines.ElementAt(2)); Assert.AreEqual("Plazo fijo por 1000.0 durante 30 días a una tna de 0.1", lines.ElementAt(3)); }