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());
        }
示例#2
0
		public void Init()
		{
			source = new Account();
			source.Deposit(200m);

			destination = new Account();
			destination.Deposit(150m);
		}
示例#3
0
 public void TransferTo(double amount, Account another)
 {
     Withdraw(amount);
     another.Deposit(amount);
 }
示例#4
0
 public void TransferFunds(Account destination, float amount)
 {
     destination.Deposit(amount);
     WithDraw(amount);
 }
示例#5
0
 public void TransferFunds(Account destination, decimal amount)
 {
     destination.Deposit(amount);
 }
示例#6
0
        public void Deposit(int ibanNr, decimal DepositSum)
        {
            Account account = FindAccount(ibanNr);

            account.Deposit(DepositSum);
        }
示例#7
0
 /// <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);
 }
示例#8
0
 /// <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);
 }
示例#9
0
 public void Execute()
 {
     Account.Deposit(Amount);
     Account.Operations.Add(this);
 }