public BootStraper() { inputService = new ConsoleInputService(); outputService = new ConsoleOutputService(); inputParse = new FirstInputeParser(); car = new Car1(); renderCarCommands = new RenderCarCommands(); }
public Car5.Infrastructure.Models.CarCommands ChooseOperation(IRenderCarCommands renderCarCommands, IOutputService outputService, IInputService inputService) { int i = 0; foreach (ICarOperation op in renderCarCommands.AvailableOperations) { outputService.WriteMessage(string.Format("{0}:{1}", i, op.OperationName)); i++; } int selection = int.Parse(Console.ReadLine()); return(renderCarCommands.AvailableOperations[selection].OperationName); }
public CarBootStraper(IUnityContainer container) { this.Container = container; List <IOutputService> outputServices = container.ResolveAll <IOutputService>().ToList(); if (container.IsRegistered <IOutputService>()) { defaultOutPutService = container.Resolve <IOutputService>(); } else { defaultOutPutService = new ConsoleOutputService(); } SetOutputService(outputServices, defaultOutPutService); if (container.IsRegistered <IInputService>()) { inputService = container.Resolve <IInputService>(); } else { inputService = new ConsoleInputService(outPutService); } if (container.IsRegistered <IOutputService>()) { outPutService = container.Resolve <IOutputService>(); } else { outPutService = new ConsoleOutputService(); } if (container.IsRegistered <IInputParserService>()) { inputParser = container.Resolve <IInputParserService>(); } else { inputParser = new FirstInputeParser(); } if (container.IsRegistered <ICar>()) { car = container.Resolve <ICar>(); } else { car = new Car(); } if (container.IsRegistered <IRenderCarCommands>()) { renderCarCommands = container.Resolve <IRenderCarCommands>(); } else { renderCarCommands = new RenderCarCommands(Container); } }