public void Visit(Account account)
        {
            AccountValidator.ValidateNumber(account.number);

            var interest = 6;
            account.Balance += ((account.Balance / 100) * interest);
        }
Exemplo n.º 2
0
        public void AddAccount(Account account)
        {
            if (account == null)
            {
                throw new ArgumentException("Account try to add is null");
            }

            this.accounts.Add(account);
        }
Exemplo n.º 3
0
        public void Visit(Account account)
        {
            if (account == null)
            {
                throw new ArgumentNullException("Account cannot be null");
            }

            AccountValidator.ValidateNumber(account.number);

            account.Balance += this.sum;
        }
Exemplo n.º 4
0
        public static void ValidateWithDrawOperation(Account account, decimal sum)
        {
            if (account.IsSavingAccount)
            {
                throw new ArgumentException("Cannot withdraw from saving account");
            }

            if (account.Balance - sum < 0)
            {
                throw new ArgumentException("Account does not have enough money");
            }
        }