public void Constructor_2x2Template_InitializedCorrectly() { GameOfLife gol = new GameOfLife("{\"r\":[{\"c\":[1,0]},{\"c\":[0,1]}]}"); Assert.True(gol.GetCell(0, 0).State == CellState.Live); Assert.True(gol.GetCell(0, 1).State == CellState.Dead); Assert.True(gol.GetCell(1, 0).State == CellState.Dead); Assert.True(gol.GetCell(1, 1).State == CellState.Live); }
public void Constructor_Initialize_AllCellsAreDead() { GameOfLife gol = new GameOfLife(); for (int x = 0; x < DEFAULT_GRID_SIZE; x++) { for (int y = 0; y < DEFAULT_GRID_SIZE; y++) { Assert.True(gol.GetCell(x, y).State == CellState.Dead); } } }
public void GetCell_WithValidPositionArgument_ReturnsNonNullCellObject() { GameOfLife gol = new GameOfLife(); Assert.NotNull(gol.GetCell(0, 0)); }
public void GetCell_WithInvalidPositionArgument_ThrowsIndexOutOfRangeException() { GameOfLife gol = new GameOfLife(); Assert.Throws<IndexOutOfRangeException>(() => gol.GetCell(DEFAULT_GRID_SIZE + 1, DEFAULT_GRID_SIZE + 1)); }