public void IsNotAliveNextGenerationTest() { DeadCell deadCell = new DeadCell(); List <Location> livingNeighbors = new List <Location> { new Location(0, 0), new Location(0, 0) }; Assert.IsFalse(deadCell.IsAliveNextGeneration(livingNeighbors)); }
public void revive_a_dead_cell_with_exactly_three_live_neighbours() { var cell = new DeadCell(); _neighbours.Add(new LiveCell().Some <Cell>()) .Add(new LiveCell().Some <Cell>()) .Add(new LiveCell().Some <Cell>()); var newCell = cell.Tick(_neighbours); newCell.Should().BeOfType <LiveCell>(); }
private static IAmACell[] randomGridCells() { var rand = new Random(); var seedCells = new IAmACell[GridWidth*GridHeight]; for (var x = 0; x < GridWidth; x++) for (var y = 0; y < GridHeight; y++) { if (rand.NextDouble() > 0.5) seedCells[x + GridWidth*y] = new LiveCell(x, y); else seedCells[x + GridWidth*y] = new DeadCell(x, y); } return seedCells; }
public void Come_Back_To_Life_With_Three_Live_Neighbours() { var neighbours = new Neighbours(); neighbours.Add(new LiveCell(null)); neighbours.Add(new LiveCell(null)); neighbours.Add(new LiveCell(null)); var cell = new DeadCell(neighbours); var cellState = cell.Tick(); Assert.That(cellState, Is.TypeOf <LiveCell>()); }
public void DeadCellIsNotAliveTest() { DeadCell cell = new DeadCell(); Assert.IsFalse(cell.IsAlive()); }
public void SetString_Sets_CellString() { DeadCell.SetString("x"); Assert.Equal("x", deadCell.ToString()); }