public void RotateLeftFromNorth_ExpectedWest() { // Arrange _rover.SetHeading(Heading.North); // Act _rover.RotateLeft(); // Assert Assert.IsTrue(_rover.GetHeading() == Heading.West); }
public void Execute(string commands, IRover rover) { foreach (var command in commands) { if (command == 'M') rover.MoveForward(); else if (command == 'L') rover.RotateLeft(); else rover.RotateRight(); } }
public void Execute(string commands, IRover rover) { foreach (var command in commands) { if (command == 'M') { rover.MoveForward(); } else if (command == 'L') { rover.RotateLeft(); } else { rover.RotateRight(); } } }
public void CommandRover(string directions) { foreach (var direction in directions) { switch (direction) { case 'L': _rover.RotateLeft(); break; case 'R': _rover.RotateRight(); break; case 'M': _rover.Move(); break; } } }
/// <summary> /// Execute command if its one of the { 'L', 'R', 'M' } /// Rover will not move further if it hit the boundary /// </summary> /// <param name="rover"></param> /// <param name="command"></param> private void ExecuteCommand(IRover rover, char command) { switch (command) { case 'L': rover.RotateLeft(); break; case 'R': rover.RotateRight(); break; case 'M': if (!_plateau.OutOfBound(rover.GetDest().X, rover.GetDest().Y)) { rover.Move(); } break; default: throw new InvalidInputException(command + " is not valid input for command!"); } }
public void RotateRoverLeft(IRover rover) { rover.RotateLeft(); }
public void Execute(IRover rover) { rover.RotateLeft(); }