Beispiel #1
0
 public void NewGeneration_when_cell_has_two_alive_neighbors_it_should_stay_alive()
 {
     Grid grid = new Grid(new Cell(1, 1), new Cell(2,1), new Cell(3,1));
     grid = grid.NewGeneration();
     grid.IsAlive(new Cell(2,1)).Should().Be(true);
 }
Beispiel #2
0
 public void NewGeneration_when_a_dead_cell_has_three_alive_neighbors_it_should_revive()
 {
     Grid grid = new Grid(new Cell(1, 1), new Cell(2, 1), new Cell(3, 1));
     grid = grid.NewGeneration();
     grid.IsAlive(new Cell(2, 2)).Should().Be(true);
 }
Beispiel #3
0
 public void NewGeneration_when_cell_has_more_than_three_alive_neighbors_it_should_die()
 {
     Grid grid = new Grid(new Cell(1, 1), new Cell(2,1), new Cell(2,2), new Cell(1,2), new Cell(3,1));
     grid = grid.NewGeneration();
     grid.IsAlive(new Cell(2,2)).Should().Be(false);
 }
Beispiel #4
0
 public void IsAlive_when_cell_is_not_in_the_list_of_alive_cells_it_should_return_false()
 {
     Grid grid = new Grid(new Cell(1,1));
     grid.IsAlive(new Cell(2,1)).Should().Be(false);
 }