public void TestExecutingACommandFileProcessingSimulatorByOneFileReturnCorrectResult()
        {
            // Arrange
            uint width         = 5;
            uint height        = 5;
            var  table         = new Table(width, height);
            var  toyRobot      = new ToyRobot(table);
            var  fileExtension = ".txt";
            var  commandFileProcessingSimulator = new CommandFileProcessingSimulator(toyRobot, fileExtension);

            var commandStringSeparator = " ";
            var ignoreCase             = true;
            var fileCommandList        = new List <string>
            {
                "./TestData/example1.txt"
            };
            var fileCommandString = string.Join(commandStringSeparator, fileCommandList);

            //Assert
            Assert.NotNull(commandFileProcessingSimulator);

            //ACT
            commandFileProcessingSimulator.Execute(fileCommandString, new[] { commandStringSeparator }, ignoreCase);

            var expectX         = 4;
            var expectY         = 2;
            var expectDirection = Direction.SOUTH;

            Assert.True(toyRobot.X == expectX && toyRobot.Y == expectY && toyRobot.Direction == expectDirection);
        }
        public void TestExecutingACommandFileProcessingSimulatorByMultipleFilesReturnCorrectResult()
        {
            // Arrange
            uint width         = 5;
            uint height        = 5;
            var  table         = new Table(width, height);
            var  toyRobot      = new ToyRobot(table);
            var  fileExtension = ".txt";
            var  commandFileProcessingSimulator = new CommandFileProcessingSimulator(toyRobot, fileExtension);

            var commandStringSeparator = " ";
            var ignoreCase             = true;
            var fileCommandList        = new List <string>
            {
                "./TestData/example1.txt",
                "./TestData/example.txt" // TEST KEY: will always get robot position and direction following last file result
            };
            var fileCommandString = string.Join(commandStringSeparator, fileCommandList);

            //Assert
            Assert.NotNull(commandFileProcessingSimulator);

            //ACT
            commandFileProcessingSimulator.Execute(fileCommandString, new[] { commandStringSeparator }, ignoreCase);

            var expectX         = 0;
            var expectY         = 1;
            var expectDirection = Direction.NORTH;

            Assert.True(toyRobot.X == expectX && toyRobot.Y == expectY && toyRobot.Direction == expectDirection);
        }
        /// <summary>
        /// this main function is running simulator for file processing
        /// </summary>
        /// <param name="fileCommandString">file command string, e.g. Sample.txt, Sample2.txt, D:\TestData\Sample.txt</param>
        private static void RunCommandFileProcessingSimulator(string fileCommandString)
        {
            // initializing a toy robot with  in the origin (0,0) facing to North
            var toyRobot = new ToyRobot(new Table(TableWidth, TableHeight));
            var commandFileProcessingSimulator = new CommandFileProcessingSimulator(toyRobot, FileExtension);

            Console.WriteLine("");
            Console.WriteLine("Processing input command files.");
            Console.WriteLine($"You are running a table size is {toyRobot.Table?.Width ?? 0} units x {toyRobot.Table?.Height ?? 0} units.");
            Console.WriteLine("");
            Console.WriteLine("Result is here:");
            Console.WriteLine("");

            try
            {
                commandFileProcessingSimulator.Execute(fileCommandString, CmdLineStringSeparator, IgnoreCase);
            }
            // we catch specific exception from file simulator, then just console log to cmd but not stop application
            catch (FileNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }
        }