Exemple #1
0
        public void UpdateTheStatusOfACellToRecordAMineAsFalse()
        {
            //Arrange
            var gridSize         = 2;
            var newGame          = GridFactory.NewGameGrid(gridSize);
            var updateMineStatus = new MineUpdater();
            var mineStub         = new StubForMineLocationZeroZero();

            //Act
            updateMineStatus.UpdateCellWithMineStatus(mineStub.MineLocations(newGame.Size), newGame);

            //Assert
            Assert.False(newGame.GeneratedGameCell[1, 1].IsMine);
        }
Exemple #2
0
        public void ReturnTwoAdjacentMinesOnASizeTwoGridAfterAPlayerMove()
        {
            //Arrange
            var newGameGrid      = GridFactory.NewGameGrid(2);
            var updateMineStatus = new MineUpdater();
            var mineStub         = new StubForTwoMineLocations();
            var userInputMove    = new PlayerMove(1, 1);

            //Act
            updateMineStatus.UpdateCellWithMineStatus(mineStub.MineLocations(newGameGrid.Size), newGameGrid);
            var result = updateMineStatus.CalculateAdjacentMineTotal(newGameGrid, userInputMove);

            //Assert
            Assert.Equal(2, result);
        }
        public void ReturnTrueIfPlayerHasSelectedAMine()
        {
            //Arrange
            var size             = 2;
            var newValidation    = Factory.NewUserInputValidation();
            var gameGrid         = GridFactory.NewGameGrid(size);
            var userInput        = new PlayerMove(0, 0);
            var updateMineStatus = new MineUpdater();
            var mineStub         = new StubForMineLocationZeroZero();

            //Act
            updateMineStatus.UpdateCellWithMineStatus(mineStub.MineLocations(gameGrid.Size), gameGrid);

            //Assert
            Assert.True(newValidation.IsGameOver(gameGrid, userInput));
        }