public void MoveRoverTestoutOfBound() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), "MMMMMMMMMM"); grid.AddRover(rover); grid.MoveRovers(); Assert.AreEqual(rover.Position.ToString(), (new Vector(4, 2)).ToString()); }
public void MoveRoverTestCollision() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), "MMM"); var rover2 = new Rover(new Vector(4, 2), new Vector(-1, 0), "LL"); grid.AddRover(rover); grid.AddRover(rover2); grid.MoveRovers(); Assert.AreEqual(rover.Position.ToString(), (new Vector(3, 2)).ToString()); Assert.AreEqual(rover2.Position.ToString(), (new Vector(4, 2)).ToString()); }
public void MultipleMoveRoverTest() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), "MMLM"); var rover2 = new Rover(new Vector(0, 0), new Vector(-1, 0), "LLM"); grid.AddRover(rover); grid.AddRover(rover2); grid.MoveRovers(); Assert.AreEqual(rover.Position.ToString(), (new Vector(4, 3)).ToString()); Assert.AreEqual(rover2.Position.ToString(), (new Vector(1, 0)).ToString()); }
public void TestUnmovingRover() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), ""); var rover2 = new Rover(new Vector(3, 1), new Vector(0, 1), "LMR"); grid.AddRover(rover); grid.AddRover(rover2); grid.MoveRovers(); var controller = new RoverController(); var result = controller.Debug("5 5\n2 2 E\n\n3 1 N\nLMR"); Assert.AreEqual(grid.DebugString(), result); }