public void Count_ThreeByThreeWithFourAliveNeighbors_ReturnsFour()
        {
            GameBoardCell[,] cells =
             {
            {
               Dead(), Alive(), Alive()
            },
            {
               Dead(), Alive(), Alive()
            },
            {
               Dead(), Dead(), Alive()
            }
             };
             var coordinates = new CellCoordinates
             {
            X = 1,
            Y = 1
             };

             var subject = new NeighborCounter();
             int count = subject.Count( cells, coordinates );

             count.Should().Be( 4 );
        }
 public int Count( GameBoardCell[,] gameBoardCells, CellCoordinates coordinates )
 {
     int numberOfLivingNeighbors = 0;
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X - 1, coordinates.Y - 1 );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X - 1, coordinates.Y );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X - 1, coordinates.Y + 1 );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X , coordinates.Y - 1 );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X, coordinates.Y + 1 );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X + 1, coordinates.Y - 1 );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X + 1, coordinates.Y );
      numberOfLivingNeighbors += PlusOneIfCellIsAlive( gameBoardCells, coordinates.X + 1, coordinates.Y + 1 );
      return numberOfLivingNeighbors;
 }
        public void Count_TwoByTwoWithTwoAliveNeighbors_ReturnsTwo()
        {
            GameBoardCell[,] cells =
             {
            {
               Dead(), Alive()
            },
            {
               Dead(), Alive()
            }
             };
             var coordinates = new CellCoordinates
             {
            X = 0, Y = 0
             };

             var subject = new NeighborCounter();
             int count = subject.Count( cells, coordinates );

             count.Should().Be( 2 );
        }