public Input(Bank bank, ConsoleMessage message) { _currentState = new CurrentState(); _preparedCommands = new Dictionary <string, Command> { ["accounts"] = new GetAccountsCommand(bank, _currentState, message), ["open"] = new OpenAccountCommand(bank, _currentState, message), ["transfer"] = new TransferCommand(bank, _currentState, message), ["close"] = new CloseAccountCommand(bank, _currentState, message), ["undo"] = new UndoCommand(bank, _currentState, message), ["abort"] = new AbortCommand(bank, _currentState, message) }; _emptyCommand = new EmptyCommand(bank, _currentState, message); }
public static void Main(string[] args) { Bank bank = new Bank(); ConsoleMessage message = new ConsoleMessage(); Input input = new Input(bank, message); while (true) { Console.WriteLine(message.Text); string command = Console.ReadLine(); if (command == "exit") { break; } input.Handle(command); } }