/// <summary> /// Initializes all the fields to their initial values for a new game. /// </summary> public void newGame() { _previousRow = 0; _previousColumn = 0; _board = new PokemonBoard(); PreviousGrid = _board.generateGrid(); CurrentGrid = PreviousGrid; PreviousScore = 0; CurrentScore = 0; _board.PointsAdded += OnPointsAdded; _board.BoardChanged += OnBoardChanged; _board.StartingPlay += OnStartingPlay; _board.EndingPlay += OnEndingPlay; OnScoreUpdated(); OnBoardChanged(this, new MakingPlayEventArgs(CurrentGrid)); }
public void setUp() { _mocks = new MockRepository(); _pokemonBoard = _mocks.PartialMock<PokemonBoard>(); _gameState = new GameState(); }
public void TryPlay_PiecesAreAdjacent_CallMakePlayAndEndPlay() { bool endedPlay = false; int rowOne = 0; int colOne = 0; int rowTwo = 0; int colTwo = 1; _mockBoard = _mocks.PartialMock<PokemonBoard>(); _mockBoard.EndingPlay += delegate { endedPlay = true; }; _mockBoard.Expect(g => g.makePlay(rowOne, colOne, rowTwo, colTwo)); _mockBoard.Replay(); _mockBoard.tryPlay(_pokemonGrid, rowOne, colOne, rowTwo, colTwo); _mockBoard.VerifyAllExpectations(); Assert.IsTrue(endedPlay); }
public void setUp() { int tokenToAdd = 0; _pokemonBoard = new PokemonBoard(); for (int row = 0; row < PokemonBoard.gridSize; row++) { for (int col = 0; col < PokemonBoard.gridSize; col++) { _pokemonGrid[row, col] = (PokemonToken)Activator.CreateInstance(PokemonBoard.TokenList[tokenToAdd++ % 6]); } } _pokemonBoard.PokemonGrid = _pokemonGrid; _pokemonBoard.NewPokemonGrid = _pokemonGrid; _mocks = new MockRepository(); _mockBoard = _mocks.PartialMock<PokemonBoard>(); _mockBoard.PokemonGrid = _pokemonGrid; _mockBoard.NewPokemonGrid = _pokemonGrid; }
public void PokemonGrid_NoError_PokemonAndNewPokemonAreEqual() { _pokemonBoard = new PokemonBoard(); Assert.AreEqual(_pokemonBoard.PokemonGrid, _pokemonBoard.NewPokemonGrid); }
public void PokemonGrid_NoError_GridInitializedToIBasicPokemon() { _pokemonBoard = new PokemonBoard(); for (int row = 0; row < PokemonBoard.gridSize; row++) { for (int col = 0; col < PokemonBoard.gridSize; col++) { Assert.IsInstanceOf(typeof(IBasicPokemonToken), _pokemonGrid[row, col]); } } }