public virtual string CanBuySnack(int position) { SnackPile snackPile = GetSnackPile(position); if (snackPile.Quantity == 0) { return("The snack pile is empty"); } if (MoneyInTransaction < snackPile.Price) { return("Not enough money"); } if (!MoneyInside.CanAllocate(MoneyInTransaction - snackPile.Price)) { return("Not enough change"); } return(string.Empty); }
public virtual void LoadSnacks(int position, SnackPile snackPile) { Slot slot = GetSlot(position); slot.SnackPile = snackPile; }
public virtual void LoadSnacks(int position, SnackPile snackPile) { var slot = Slots.Single(x => x.Position.Equals(position)); slot.SnackPile = snackPile; }