public void ShouldUpdateAllCells() { Universe universe = new Universe(CellGridFactory.FromCellStateArray( new CellState[, ] { { X, X, X, O }, { O, X, O, O }, { X, O, X, X }, { O, O, X, X } })); CellState[,] expected = new CellState[, ] { { X, X, X, O }, { O, O, O, X }, { O, O, O, X }, { O, X, X, X } }; universe.Update(); CellState[,] actual = universe.GetState(); Assert.Equal(expected, actual); }
public void ShouldUpdateItsState() { Universe universe = new Universe(CellGridFactory.FromCellStateArray(new CellState[, ] { { X } })); universe.Update(); CellState[,] actual = universe.GetState(); Assert.Equal(new CellState[, ] { { O } }, actual); }
public void ShouldStoreItsInitialState() { CellState[,] original = new CellState[, ] { { X, O, X }, { O, O, X }, { X, O, X } }; Universe universe = new Universe(CellGridFactory.FromCellStateArray(original)); CellState[,] actual = universe.GetState(); Assert.Equal(original, actual); }
public void ShouldReturnArrayOfCellsWithSameCellStates(CellState[,] initial, Cell[,] expected) { Cell[,] result = CellGridFactory.FromCellStateArray(initial); Assert.Equal(expected, result); }
public void ShouldThrowArgumentNullExceptionWhenNullIsPassed() { Action action = () => CellGridFactory.FromCellStateArray(null); Assert.Throws <ArgumentNullException>(action); }