public void When_the_hand_of_god_touches_a_live_cell() { var cell_died = false; var cell = Cell.ThatsAliveWithNeighbors(0); cell.When_it_dies = () => cell_died = true; cell.Touched(); Assert.That(cell_died, "Touching a live cell should kill it."); }
public void When_a_live_cell_has_more_than_three_neighbors_and_a_moment_passes() { var cell = Cell.ThatsAliveWithNeighbors(4); var cell_died = false; cell.When_it_dies = () => cell_died = true; cell.MomentPassed(); Assert.That(cell_died, "it should die as if from overcrowding."); }
public void When_a_cell_has_three_neighbors_and_a_moment_passes() { var cell = Cell.ThatsAliveWithNeighbors(3); var cell_died = false; cell.When_it_dies = () => cell_died = true; cell.MomentPassed(); Assert.That(cell_died, Is.False, "It should live on."); }
public void When_a_live_cell_is_notified_that_a_neighbor_died() { var cell_died = false; var cell = Cell.ThatsAliveWithNeighbors(2); cell.When_it_dies = () => cell_died = true; cell.NeighborDied(); cell.MomentPassed(); Assert.That(cell_died, "it should affect its view of the world."); }