Пример #1
0
 public void Corner_cells_can_be_set()
 {
     World world = new World(Height, Width);
     world.SetCell(world.GetCoordinate(0, 0), Cell.Alive);
     world.SetCell(world.GetCoordinate(0, Width - 1), Cell.Alive);
     world.SetCell(world.GetCoordinate(Height - 1, Width - 1), Cell.Alive);
     world.SetCell(world.GetCoordinate(Height - 1, 0), Cell.Alive);
 }
Пример #2
0
 public void ToString_returns_a_grid_representing_the_world()
 {
     World world = new World(3, 3);
     Assert.AreEqual("- - -\r\n- - -\r\n- - -", world.ToString());
     world.SetCell(world.GetCoordinate(0, 0), Cell.Alive);
     world.SetCell(world.GetCoordinate(2, 0), Cell.Alive);
     world.SetCell(world.GetCoordinate(1, 1), Cell.Alive);
     world.SetCell(world.GetCoordinate(0, 2), Cell.Alive);
     world.SetCell(world.GetCoordinate(2, 2), Cell.Alive);
     Assert.AreEqual("O - O\r\n- O -\r\nO - O", world.ToString());
 }
Пример #3
0
 public void Cell_can_be_retrieved_as_set()
 {
     World world = new World(Height, Width);
     const int row = 2;
     const int column = 2;
     Coordinate coordinate = world.GetCoordinate(row, column);
     world.SetCell(coordinate, Cell.Alive);
     Assert.IsTrue(world.GetCell(coordinate).IsAlive());
 }