Exemplo n.º 1
0
        public void ExecutionOutput_PathWithoutRepeatingCells_ReturnsCorrectValue()
        {
            var position = new Location(10, 22);
            var expectedOutput = "=> Cleaned: 2";
            IList<MovementInstruction> instructions = new List<MovementInstruction>();
            instructions.Add(new MovementInstruction(Direction.East, 1));

            var cleaningProgram = new CleaningProgram(position, instructions);
            var robot = new Robot(cleaningProgram);

            robot.Clean();
            var output = robot.ExecutionOutput();

            Assert.AreEqual(expectedOutput, output);
        }
Exemplo n.º 2
0
        public void ExecutionOutput_NoInstructionsProvided_ReturnsCorrectValue()
        {
            var position = new Location(10, 22);
            var expectedOutput = "=> Cleaned: 1";
            IList<MovementInstruction> instructions = new List<MovementInstruction>();

            var cleaningProgram = new CleaningProgram(position, instructions);
            var robot = new Robot(cleaningProgram);

            robot.Clean();

            var output = robot.ExecutionOutput();

            Assert.AreEqual(expectedOutput, output);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            InstructionsReader reader = new InstructionsReader();

            var totalInstructions = reader.ReadTotalInstructions(Console.ReadLine());

            reader.ReadInitialPosition(Console.ReadLine());

            for (var i = 0; i < totalInstructions; i++)
            {
                reader.ReadMoveInstruction(Console.ReadLine());
            }

            var cleaningProgram = reader.BuildCleaningProgram();

            Robot robot = new Robot(cleaningProgram);

            robot.Clean();

            Console.WriteLine(robot.ExecutionOutput());
        }