static void Main(string[] args) { int result = 2; while (result == 2) { IGarageManager garageManager = new GarageManagerFactory().Create(); IConsoleInputOutput consoleInputOutput = new ConsoleInputOutput(); IVehicleManager vehicleManager = VehicleManagerFactory.Create(garageManager); IVehicleParser vehicleParser = new VehicleParser(); IGarageParser garageParser = new GarageParser(); IFileInputOutput file = new FileInputOutput(); ICsvImporter csvImporter = new CsvImporter(file, vehicleParser); ICommandExecuterFactory commandExecuterFactory = new CommandExecuterFactory(vehicleManager, consoleInputOutput, vehicleParser, garageManager, garageParser, csvImporter, file); var commandLineParser = new CommandLineParser(consoleInputOutput, CommandDictionaryFactory.Create(), vehicleManager, commandExecuterFactory); while ((result = commandLineParser.ReadCommand()) == 1) { ; } if (result == 2) { consoleInputOutput.WriteInfo("Daten werden wiederhergestellt."); } } }
public void ReadCommandTest_FindCarsByLicensePlateWasCalled() { bool isCalled = false; var consoleMock = new ConsoleMock("select 1;", null, null); var vehicleManagerMock = new vehicleManagerMock((s) => { if (s == "1") { isCalled = true; } }); vehicleManagerMock.FindCarsByLicensePlateReturn = new Dictionary <Vehicle, ParkingPlaceOutput>(); var factory = new CommandExecuterFactory(vehicleManagerMock, consoleMock, null, null, null, null, null); var sut = new CommandLineParser(consoleMock, CommandDictionaryFactory.Create(), vehicleManagerMock, factory); sut.ReadCommand(); Assert.IsTrue(isCalled); }