public void TestProcessMonthlyInterest() { TestSnapShotDailyBalance(); InterestController interestController = new InterestController(); double interestRate = interestController.GetInterestRate(_unitUnderTest); _unitUnderTest.ProcessMonthlyInterest(interestRate); Assert.AreEqual(105 + ((150.0 + 105.0) / 2 * interestRate) /*108.1875*/, _unitUnderTest.GetBalance()); Account oldAccount = new Account(150, new DateTime(DateTime.Now.AddYears(-7).Ticks)); oldAccount.SnapShotDailyBalance(); oldAccount.Withdraw(45); oldAccount.SnapShotDailyBalance(); interestRate = interestController.GetInterestRate(oldAccount); oldAccount.ProcessMonthlyInterest(interestRate); Assert.AreEqual(105 + ((150.0 + 105.0) / 2 * interestRate), oldAccount.GetBalance()); Account newAccountWHighBalance = new Account(70000); newAccountWHighBalance.SnapShotDailyBalance(); newAccountWHighBalance.Deposit(60000); newAccountWHighBalance.SnapShotDailyBalance(); interestRate = interestController.GetInterestRate(newAccountWHighBalance); newAccountWHighBalance.ProcessMonthlyInterest(interestRate); Assert.AreEqual(130000 + ((70000.0 + 130000.0) / 2 * interestRate) /*132500*/, newAccountWHighBalance.GetBalance()); Account oldAccountWHighBalance = new Account(70000, new DateTime(DateTime.Now.AddYears(-7).Ticks)); oldAccountWHighBalance.SnapShotDailyBalance(); oldAccountWHighBalance.Deposit(60000); oldAccountWHighBalance.SnapShotDailyBalance(); interestRate = interestController.GetInterestRate(oldAccountWHighBalance); oldAccountWHighBalance.ProcessMonthlyInterest(interestRate); Assert.AreEqual(130000 + ((70000.0 + 130000.0) / 2 * interestRate), oldAccountWHighBalance.GetBalance()); }
public void Init() { source = new Account(); source.Deposit(200m); destination = new Account(); destination.Deposit(150m); }
public void TransferTo(double amount, Account another) { Withdraw(amount); another.Deposit(amount); }
public void TransferFunds(Account destination, float amount) { destination.Deposit(amount); WithDraw(amount); }
public void TransferFunds(Account destination, decimal amount) { destination.Deposit(amount); }
public void Deposit(int ibanNr, decimal DepositSum) { Account account = FindAccount(ibanNr); account.Deposit(DepositSum); }
/// <summary> /// Transfer money from one account to another. /// </summary> /// <param name="fromAccount">Sender.</param> /// <param name="toAccount">Receiving account.</param> /// <param name="sum">Sum of transaction</param> public void Transaction(Account fromAccount, Account toAccount, decimal sum) { fromAccount.WidthRaw(sum); toAccount.Deposit(sum); }
/// <summary> /// Adds money to some account. /// </summary> /// <param name="account">Account.</param> /// <param name="sum">Sum of adding money</param> public void DepositAccount(Account account, decimal sum) { account.Deposit(sum); }
public void Execute() { Account.Deposit(Amount); Account.Operations.Add(this); }