public void BottomRightCellWithExactly3NeightborsComesToLife() { var grid = new Int32[,] { { 0, 0, 0 }, { 0, 1, 1 }, { 0, 1, 0 } }; var game = new GameOfLife(grid); var actual = game.CheckGrid(); var expected = new Int32[,] { { 0, 0, 0 }, { 0, 1, 1 }, { 0, 1, 1 } }; Assert.That(actual, Is.EqualTo(expected)); }
public void BiggerGridReturnsTheCorrectResult() { var grid = new Int32[,] { { 0, 0, 0, 1, 0 }, { 1, 1, 0, 1, 1 }, { 0, 0, 1, 0, 0 }, { 1, 1, 0, 0, 0 }, { 0, 0, 1, 0, 0 } }; var game = new GameOfLife(grid); var actual = game.CheckGrid(); var expected = new Int32[,] { { 0, 0, 1, 1, 1 }, { 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0 }, { 0, 1, 1, 0, 0 }, { 0, 1, 0, 0, 0 } }; Assert.That(actual, Is.EqualTo(expected)); }
public void TwoIterationsOfAGridReturnsTheCorrectResult() { var grid = new Int32[,] { { 1, 1, 1 }, { 1, 0, 0 }, { 0, 1, 1 } }; var game = new GameOfLife(grid); var firstRun = game.CheckGrid(); var actual = game.CheckGrid(); var expected = new Int32[,] { { 1, 1, 0 }, { 1, 0, 0 }, { 0, 0, 0 } }; Assert.That(actual, Is.EqualTo(expected)); }
public void CellWithExactlyTwoOrLessNeighborsDies() { var grid = new Int32[,] { { 0, 0, 0 }, { 1, 1, 0 }, { 0, 0, 1 } }; var game = new GameOfLife(grid); var actual = game.CheckGrid(); var expected = new Int32[,] { { 0, 0, 0 }, { 0, 1, 0 }, { 0, 1, 0 } }; Assert.That(actual, Is.EqualTo(expected)); }