public void TestMove(string movements, char direction, int startX, int startY, int finalX, int finalY) { Grid world = new Grid(10, 10); Rover rover = new Rover(startX, startY, direction); world.GridCellAt(3, 5).ContainsObstacle = true; world.GridCellAt(3, 6).ContainsObstacle = true; world.GridCellAt(1, 8).ContainsObstacle = true; world.GridCellAt(7, 4).ContainsObstacle = true; world.GridCellAt(6, 2).ContainsObstacle = true; rover.World = world; foreach (char movement in movements) { if (!rover.Move(movement)) { break; } } Console.WriteLine("Final Location: " + rover.CurrentLocation.X + " " + rover.CurrentLocation.Y); Assert.AreEqual(finalX, rover.CurrentLocation.X); Assert.AreEqual(finalY, rover.CurrentLocation.Y); }
public void TestGridCellAt(int x, int y, int expectedX, int expectedY) { Grid grid = new Grid(10, 10); GridCell gridCell = grid.GridCellAt(x, y); Assert.AreEqual(expectedX, gridCell.X); Assert.AreEqual(expectedY, gridCell.Y); }
private static Grid CreateWorld() { Grid world = new Grid(10, 10); world.GridCellAt(3, 5).ContainsObstacle = true; world.GridCellAt(3, 6).ContainsObstacle = true; world.GridCellAt(1, 8).ContainsObstacle = true; world.GridCellAt(7, 4).ContainsObstacle = true; world.GridCellAt(6, 2).ContainsObstacle = true; return world; }
public void Setup() { grid = new Grid(10, 10, new List<Coordinate>()); }
public void Setup() { obstacles = new List<Coordinate>(); obstacles.Add(new Coordinate(5, 5)); grid = new Grid(10, 10, obstacles); }