public void Test_Wrapping_On_3_X_3_Grid() { Rover rover = new Rover(); rover.PositionHeading = "E"; rover.PositionY = 0; rover.PositionX = 0; rover.LandscapeHeight = 3; rover.LandscapeWidth = 3; Landscape landscape = new Landscape(rover); landscape.BuildLandscapeGrid(false); string[] commands = new string[] { "F", "F", "F", "F" }; foreach (string s in commands) { rover.Command_Receiver(s); //rover.Drive_Forward(); } Assert.AreEqual(0, rover.PositionY); Assert.AreEqual(1, rover.PositionX); }
public void Test_Rover_Left_Turn_South() { Rover rover = new Rover(); rover.PositionHeading = "W"; Navigation navigation = new Navigation(rover); rover.Command_Receiver("L"); Assert.AreEqual("S", navigation.GetDirectionalHeading()); }
public void Test_Rover_Turns_West() { Rover rover = new Rover(); rover.PositionHeading = "S"; Navigation navigation = new Navigation(rover); rover.Command_Receiver("R"); Assert.AreEqual("W", navigation.GetDirectionalHeading()); }
public void Test_Rover_Drives_East_One_Space() { Rover rover = new Rover(); rover.PositionHeading = "E"; rover.PositionX = 1; rover.PositionY = 0; rover.LandscapeWidth = 3; rover.LandscapeHeight = 3; Landscape landscape = new Landscape(rover); landscape.BuildLandscapeGrid(false); rover.Command_Receiver("F"); Assert.AreEqual(2, rover.PositionX); }
public void Test_Rover_Reverses_North_One_Space() { Rover rover = new Rover(); rover.PositionHeading = "S"; rover.PositionX = 0; rover.PositionY = 0; rover.LandscapeWidth = 2; rover.LandscapeHeight = 2; Landscape landscape = new Landscape(rover); landscape.BuildLandscapeGrid(false); rover.Command_Receiver("b"); Assert.AreEqual(1, rover.PositionY); }
public void Test_Rovers_Position_From_Multiple_Reverse_Commands() { Rover rover = new Rover(); rover.PositionHeading = "N"; rover.PositionY = 1; rover.PositionX = 1; rover.LandscapeHeight = 3; rover.LandscapeWidth = 3; Landscape landscape = new Landscape(rover); landscape.BuildLandscapeGrid(false); string[] commands = new string[] { "B", "B", "B", "L", "F" }; foreach (string s in commands) { rover.Command_Receiver(s); } Assert.AreEqual(1, rover.PositionY); Assert.AreEqual(0, rover.PositionX); }
public void Test_Rovers_Position_From_Multiple_Drive_And_Turn_Commands() { Rover rover = new Rover(); rover.PositionHeading = "W"; rover.PositionY = 0; rover.PositionX = 3; rover.LandscapeHeight = 4; rover.LandscapeWidth = 4; Landscape landscape = new Landscape(rover); landscape.BuildLandscapeGrid(false); string[] commands = new string[] { "F", "F", "R", "F", "F" }; foreach (string s in commands) { rover.Command_Receiver(s); } Assert.AreEqual(2, rover.PositionY); Assert.AreEqual(1, rover.PositionX); }
public void Test_Rover_Only_Accepts_Vaild_Commands() { Rover rover = new Rover(); rover.Command_Receiver("GO"); }