Example #1
0
        public void Commands_puppeteer_enqueue_spiral()
        {
            Action <string> reportCallback = (string rep) => {
                Debug.WriteLine(rep);
                Assert.AreEqual("2,2,EAST", rep);
            };
            var puppeteer = new Puppeteer(_robot, reportCallback);

            puppeteer.EnqueueCommands(TestData.DataSupport.GetSpiralCommands().ToList());
            puppeteer.ExecuteQueue();
        }
Example #2
0
        private static void Run()
        {
            try
            {
                var puppeteer = new Puppeteer(_diContainer.Resolve <IRobot>(), (r) => { System.Console.WriteLine(r); });
                if (!string.IsNullOrWhiteSpace(_opts.File))
                {
                    //versione batch
                    if (File.Exists(_opts.File))
                    {
                        var commands = File.ReadAllLines(_opts.File);
                        puppeteer.EnqueueCommands(commands.ToList());
                        puppeteer.ExecuteQueue();
                    }
                    else
                    {
                        System.Console.WriteLine("The file provided does not exists");
                    }
                }
                else
                {
                    System.Console.WriteLine("Getting started with your Toy Robot, please write commands:");
                    var command = string.Empty;
                    do
                    {
                        command = System.Console.ReadLine();
                        puppeteer.ExecuteCommand(command);
                    } while (command != "EXIT");
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Ops.. an error has occured");
            }

            System.Console.ReadLine();
        }