public void Constructor_Valid() { var rover = new Rover(0, 0, 'N'); Assert.AreEqual(0, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_ForwardFromNonOrigin_Valid() { var rover = new Rover(1, 1, 'N'); rover.Command('F'); Assert.AreEqual(1, rover.X); Assert.AreEqual(2, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_Backward_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('B'); Assert.AreEqual(0, rover.X); Assert.AreEqual(100, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_ForwardTwice_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('F'); rover.Command('F'); Assert.AreEqual(0, rover.X); Assert.AreEqual(2, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_Turn_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('R'); Assert.AreEqual(0, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('E', rover.Heading); }
public void Command_Sequence_WithObstacles_Throws() { var obstacles = new List<Obstacle> { new Obstacle { X = 0, Y = 2 } }; var rover = new Rover(0, 0, 'N', 200, 200, obstacles); Assert.Throws<ObstacleException>(() => rover.Command("FF")); Assert.AreEqual(0, rover.X); Assert.AreEqual(1, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_SequenceVaryingGridSize_Valid() { var rover = new Rover(0, 0, 'N', 200, 200); rover.Command("RRFF"); Assert.AreEqual(0, rover.X); Assert.AreEqual(199, rover.Y); Assert.AreEqual('S', rover.Heading); }
public void Command_Sequence_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command("FFRFF"); Assert.AreEqual(2, rover.X); Assert.AreEqual(2, rover.Y); Assert.AreEqual('E', rover.Heading); }
public void Command_TurnLeftFromNorthThreeTimes_MoveBackwardsTwice_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('L'); rover.Command('L'); rover.Command('L'); rover.Command('B'); rover.Command('B'); Assert.AreEqual(99, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('E', rover.Heading); }
public void Command_TurnLeftFromNorth_MoveBackward_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('L'); rover.Command('B'); rover.Command('B'); Assert.AreEqual(2, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('W', rover.Heading); }
public void Command_TurnRightFromNorthThreeTimes_MoveForwardTwice_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('R'); rover.Command('R'); rover.Command('R'); rover.Command('F'); rover.Command('F'); Assert.AreEqual(99, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('W', rover.Heading); }
public void Command_TurnRightFromNorth_MoveForward_Valid() { var rover = new Rover(0, 0, 'N'); rover.Command('R'); rover.Command('F'); rover.Command('F'); Assert.AreEqual(2, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('E', rover.Heading); }
public void Command_TurnLeftFromEast_Valid() { var rover = new Rover(0, 0, 'E'); rover.Command('L'); Assert.AreEqual(0, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('N', rover.Heading); }
public void Command_TurnRightFromWest_Valid() { var rover = new Rover(0, 0, 'W'); rover.Command('R'); Assert.AreEqual(0, rover.X); Assert.AreEqual(0, rover.Y); Assert.AreEqual('N', rover.Heading); }