public void PacmanAfterMovedIsEmpty() { var grid = new Grid(3, 3); grid.PlacePacmanAt(0, 0); grid.MovePacmanTo(1, 0); Assert.Equal(' ', grid.At(0, 0)); }
public void AllCellsVisitedByPacManAreNotFilledWithDots() { var grid = new Grid(4, 8); var originPosition = new Position(0, 0); var positionNextToActual = new Position(1, 0); grid.PlacePacManAt(originPosition); grid.MovePacManTo(positionNextToActual); Assert.NotEqual(Grid.FilledCell, grid.At(originPosition)); }
public void PacmanIsOnDefinedPositionAndGridIsStillFilledByDots() { var grid = new Grid(3, 3); grid.PlacePacmanAt(0, 0); Assert.Equal('.', grid.At(1, 1)); }
public void PacmanIsOnDefinedPosition() { var grid = new Grid(3, 3); grid.PlacePacmanAt(0, 0); Assert.Equal(PacmanDirectionNone, grid.At(0, 0)); }
public void GridIsFilledByDots() { var grid = new Grid(3, 3); Assert.Equal('.', grid.At(0, 0)); }
public void GridHasDefinedCountOfRows(int rowCount, int columnCount) { var grid = new Grid(rowCount, columnCount); Assert.Equal(rowCount, grid.GetRowCount()); Assert.Equal(columnCount, grid.GetCollCount()); }
public void CellNearPacmanIsFilledWithDot() { var grid = new Grid(4, 8); var originPosition = new Position(0, 0); var positionNextToActual = new Position(1, 0); grid.PlacePacManAt(originPosition); Assert.Equal(Grid.FilledCell, grid.At(positionNextToActual)); }
private static void AssertFilledWithDots(Grid grid, int width, int height) { for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { var position = new Position(x, y); Assert.Equal(Grid.FilledCell, grid.At(position)); } } }
public Game(Grid grid) { _grid = grid; }
public void PacmanMovesAfterTick(Game.Direction direction, int nextX, int nextY) { var grid = new Grid(4, 8); var originPosition = new Position(0, 0); var positionNextToActual = new Position(nextX, nextY); grid.PlacePacManAt(originPosition); var game = new Game(grid); game.PacmanDirection = direction; game.Tick(); Assert.Equal(Grid.PacMan, grid.At(positionNextToActual)); }
public void WithPacmansHeadYouDontBreakThrough() { var grid = new Grid(4, 8); var originPosition = new Position(0, 0); var positionNextToActual = new Position(-1, 0); grid.PlacePacManAt(originPosition); Assert.Throws<InvalidMoveException>(() => grid.MovePacManTo(positionNextToActual)); }
public void PacManCantMoveToWall() { var grid = new Grid(4, 8); var positionWall = new Position(2, 0); grid.PlaceWall(positionWall); var originPosition = new Position(0, 0); var positionNextToActual = new Position(2, 0); grid.PlacePacManAt(originPosition); Assert.Throws<InvalidMoveException>(() => grid.MovePacManTo(positionNextToActual)); }
public void PacManCantMoveIfItDoesNotExist() { var grid = new Grid(4, 8); var somePosition = new Position(2, 1); Assert.Throws<InvalidMoveException>(() => grid.MovePacManTo(somePosition)); }
public void NewPacmanIsLookingToTheRight() { var grid = new Grid(4, 8); var game = new Game(grid); Assert.Equal(Game.Direction.Right, game.PacmanDirection); }
public void GridIsFilledWithDots() { const int width = 4; const int height = 8; var grid = new Grid(width, height); AssertFilledWithDots(grid, width, height); }
public void CellWithPacmanIsNotFilledWithDot() { var grid = new Grid(4, 8); var originPosition = new Position(0, 0); grid.PlacePacManAt(originPosition); Assert.NotEqual(Grid.FilledCell, grid.At(originPosition)); }