static void Main(string[] args) { WendingMachine machine = new WendingMachine(balance: 0, goods: new Good[] { new Good("Шоколадка", price: 70, count: 5), new Good("Газировка", price: 60, count: 2) } ); ICommandInput input = new ConsoleCommandInput(new Router(machine)); while (true) { Console.Clear(); Console.WriteLine($"Баланс {machine.Balance}"); var command = input.GetCommand(); if (command == null) { Console.WriteLine("Команда не распознана"); } else { command.Execute(); } Console.ReadKey(); } }
public BuyGood(WendingMachine machine, IOrder order) { _machine = machine; _order = order; }
public Router(WendingMachine machine) { _machine = machine; _state = new DefaultState(this); }
public AddMoney(WendingMachine machine, int money) { _machine = machine; _money = money; }
public GetChange(WendingMachine machine) { _machine = machine; }