Esempio n. 1
0
        /// <summary>
        /// Add sum to account
        /// </summary>
        /// <param name="sum"></param>
        public void Deposit(decimal sum, IBonus bonusLogic)
        {
            if (sum < 0)
            {
                throw new ArgumentException("Sum cannot be negative");
            }

            if (IsActive)
            {
                Balance += sum;
                Bonus   += bonusLogic.Deposit(sum, Type);
            }
            else
            {
                throw new Exception("Account closed");
            }
        }