public void WhenGivenNoSeedCoords_SeedGrid_CreatesGridWithAllDeadCells() { List <Tuple <int, int> > seedCoords = new List <Tuple <int, int> >(); Domain.IGridService gridService = new Domain.GridService(new Moq.Mock <ICellService>().Object); Grid grid = gridService.SeedGrid(10, 10, seedCoords); int totalAliveCells = grid.Cells.Sum(x => x.Count(y => y.State == CellState.alive)); Assert.True(totalAliveCells == 0); }
public void WhenGivenHeightAndWidth_SeedGrid_CreatesGridWithCorrectDimensions() { int height = 10; int width = 8; List <Tuple <int, int> > seedCoords = new List <Tuple <int, int> >(); Domain.IGridService gridService = new Domain.GridService(new Moq.Mock <ICellService>().Object); Grid grid = gridService.SeedGrid(height, width, seedCoords); Assert.True(grid.Height == height && grid.Width == width); }
public void WhenGivenOneSeedCoord_SeedGrid_CreatesGridWithCorrectCellAlive() { int xCoord = 3; int yCoord = 2; List <Tuple <int, int> > seedCoords = new List <Tuple <int, int> >(); seedCoords.Add(new Tuple <int, int>(xCoord, yCoord)); Domain.IGridService gridService = new Domain.GridService(new Moq.Mock <ICellService>().Object); Grid grid = gridService.SeedGrid(10, 10, seedCoords); int totalAliveCells = grid.Cells.Sum(x => x.Count(y => y.State == CellState.alive)); Assert.True(totalAliveCells == 1 && grid.Cells[xCoord][yCoord].State == CellState.alive); }