public static void Main(string[] args) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); try { log.Info("INIT - TOY ROBOT"); var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var configuration = builder.Build(); ToyRobotService _toyRobot = new ToyRobotService(); log.Info("SETUP - TOY ROBOT"); int width = int.Parse(configuration["width"]); int height = int.Parse(configuration["height"]); _toyRobot.SetWidth(width); _toyRobot.SetHeight(height); log.Info("START - TOY ROBOT"); while (1 == 1) { try { var output = _toyRobot.SendCommand(Console.ReadLine()); if (output != null) { Console.WriteLine(output); } } catch (Exception ex) { log.Error(ex.Message); } } } catch (Exception ex) { log.Error(ex.Message); } }
public ToyRobotUnitTest() { _toyRobot = new ToyRobotService(); _toyRobot.SetWidth(5); _toyRobot.SetHeight(5); }