Exemplo n.º 1
0
        private static void PrintRoverInfo(IRover rover, string message)
        {
            PrintInNewLine(Line);

            PrintInNewLine($"Energy: {rover.GetEnergy().GetLoad()}");
            PrintInNewLine($"Direction: {rover.GetDirection()}");
            PrintInNewLine($"Position (x: {rover.GetPosition().GetX()}, y: {rover.GetPosition().GetY()})");
            PrintInSameLine("Messages: ");

            if (message != null)
            {
                PrintInSameLine($"{message} ", ConsoleColor.White, ConsoleColor.Black, false);
            }

            Jump();

            PrintInNewLine(Line);

            Jump();
        }
Exemplo n.º 2
0
 public Position GetRoverPosition(IRover rover)
 {
     return(rover.GetPosition());
 }
Exemplo n.º 3
0
        public void MoveForwardFacingNorth()
        {
            // Arrange
            _rover.SetHeading(Heading.North);

            // Act
            var x = _rover.GetPosition().X;
            var y = _rover.GetPosition().Y;

            _rover.MoveForward();

            // Assert
            Assert.IsTrue(_rover.GetPosition().X == x && _rover.GetPosition().Y == y + 1);
        }
Exemplo n.º 4
0
        public void Execute(IRover rover)
        {
            var targetPosition = rover.GetOrientation().GetDiffrenece() + rover.GetPosition();

            rover.UpdatePosition(targetPosition);
        }