private void Birth_if_three_living_neighbours(ICell cell) { var neighboursAlive = cell.Neighbours.Count(x => x.State == CellState.Alive); if (cell.State == CellState.Dead && neighboursAlive == 3) Assert.That(cell.GetNextState(), Is.EqualTo(CellState.Alive)); }
private void Survival_if_two_or_three_living_neigbours(ICell cell) { var neighboursAlive = cell.Neighbours.Count(x => x.State == CellState.Alive); if (cell.State == CellState.Alive && (neighboursAlive == 2 || neighboursAlive == 3)) Assert.That(cell.GetNextState(), Is.EqualTo(CellState.Alive)); else Assert.Inconclusive(); }
private static void Less_than_two_neighbours_death(ICell cell) { if (cell.Neighbours.Count(x => x.State == CellState.Alive) < 2) Assert.That(cell.GetNextState(), Is.EqualTo(CellState.Dead)); }
private void More_than_three_living_neigbours_death(ICell cell) { if (cell.Neighbours.Count(x => x.State == CellState.Alive) > 3) Assert.That(cell.GetNextState(), Is.EqualTo(CellState.Dead)); }