public virtual void ReturnMoney() { Money moneyToReturn = MoneyInside.AllocateCore(MoneyInTransaction); MoneyInside -= moneyToReturn; MoneyInTransaction = 0; }
public virtual void BuySnack(int position) { if (CanBuySnack(position) != string.Empty) { throw new InvalidOperationException(); } var slot = GetSlot(position); slot.SnackPile = slot.SnackPile.SubstractOne(); var change = MoneyInside.AllocateCore(MoneyInTransaction - slot.SnackPile.Price); MoneyInside -= change; MoneyInTransaction = 0; }