Exemple #1
0
        public Atm NewAtmInstalled(IIdentity id, double cashBalance)
        {
            var atm = new Atm(id, cashBalance);

            _atms.Add(atm);

            DomainEvent.OnPublished(new OnAtmCreatedEventArgs(atm, Id));

            return(atm);
        }
Exemple #2
0
        public static void WithdrawCashFromAtm(Atm atm, double amount)
        {
            if (amount <= 0)
            {
                throw new Exception("Cannot withdraw a zero or negative amount");
            }

            if (atm.CashBalance < amount)
            {
                throw new Exception("Not enough cash in ATM");
            }

            atm.AddCash(-amount);
        }