示例#1
0
        public Amount Withdrawal(Amount amount, DateTime dateTime)
        {
            if (amount.isNegative())
            {
                throw new Exception("Impossible to make the withdrawal : negative amount");
            }

            _balance.DecreaseAmount(amount);
            Operation withdrawal = new Withdrawal(amount, dateTime);

            _operations.AddOperation(withdrawal);
            return(amount);
        }
示例#2
0
 public void Deposit(Amount amount, DateTime dateTime)
 {
     if (amount.isNegative())
     {
         throw new Exception("Impossible to make the deposit : negative amount");
     }
     if (amount.isPositive())
     {
         _balance.IncreaseAmount(amount);
         Operation deposit = new Deposit(amount, dateTime);
         _operations.AddOperation(deposit);
     }
 }