public bool Withdraw(Money amount) { // TODO: This should generate a transaction if (_balance < amount) { throw new InsufficientFundsException(); } if (amount.Amount < 0) { throw new InvalidAmountException(); } // Remove balance from this account _balance = _balance - amount; return true; }
public bool Transfer(Account a, Money amount) { if (_balance < amount) { throw new InsufficientFundsException(); } if (amount.Amount < 0) { throw new InvalidAmountException(); } // Remove balance from this account _balance = _balance - amount; // Add balance to Account a a._balance = a._balance + amount; return true; }
public Account(Money balance) { this._balance = balance; }