public void WhenStarting12N_AndMoveCommandLMLMLMLMM_AssertSuccesfulMove() { _rover.SetPosition(1, 2, RoverDirection.North); var moves = "LMLMLMLMM"; _rover.ProcessCommands(moves); var expectedPosition = "1 3 N"; Assert.AreEqual(expectedPosition, _rover.CurrentPosition()); }
public void WhenProcessingInstructionsCommad_RoverSucessfullyMoved() { var instructions = "MMM"; var instructionsCommand = "Rover Insturctions: " + instructions; var rover = new MarsRover(DefaultPlateauWidth, DefaultPlateauHeight); var commandTokenizerMock = new Mock <ITokenizer>(); commandTokenizerMock .Setup(x => x.Tokenize(instructionsCommand)) .Returns(() => new List <DslToken>() { new DslToken(TokenType.StringValue, "Rover"), new DslToken(TokenType.Instructions, "Insturctions:"), new DslToken(TokenType.StringValue, instructions), new DslToken(TokenType.SequenceTerminator) }); MarsRoverExercise.Program.ProcessCommand(ref rover, commandTokenizerMock.Object, instructionsCommand, 1); Assert.IsTrue("0 3 N" == rover.CurrentPosition()); }