public void BoardResizeOnTick() { InfiniteBoard board = new InfiniteBoard(new bool[,] { { false, false, false, false, false }, { false, true, true, true, false }, { false, false, false, false, false } }); board.Tick(); bool[,] expected = new bool[,] { { false, false, false, false, false, false, false }, { false, false, false, true, false, false, false }, { false, false, false, true, false, false, false }, { false, false, false, true, false, false, false }, { false, false, false, false, false, false, false } }; CollectionAssert.AreEqual(expected, board.CurrentBoard); }
public void InfiniteBoardEnsureTheWorldHasZeroCells() { InfiniteBoard world = new InfiniteBoard(); int expectedNumberOfCells = 0; int actualNumberOfCells = world.CellCount(); Assert.AreEqual(expectedNumberOfCells, actualNumberOfCells); }
public void InfiniteBoardEnsureThereAreCells() { InfiniteBoard world = new InfiniteBoard(); int x = 4; int y = 3; world.AddCell(x, y); Assert.AreEqual(1, world.CellCount()); }
public void InfiniteBoardDeadRule() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(1, 0); world.AddCell(0, 1); world.AddCell(1, 1); world.DeadRule(0, 0); Assert.AreEqual(true, world.CellDoesExist(0, 0)); }
public void InfiniteBoardGetNumberOfAliveNeighhbors() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(0, 0); world.AddCell(1, 0); world.AddCell(0, 1); world.AddCell(1, 1); int alive = world.getNumberOfAliveNeighbors(world.Cells[0].X, world.Cells[0].Y); Assert.AreEqual(3, alive); }
public void CanGetDimensionsOfBoard() { InfiniteBoard NewBoard = new InfiniteBoard(); NewBoard.Cells = new List<List<bool>>() { new List<bool>() { true, false, false }, new List<bool>() { true, false, false }, new List<bool>() { true, false, false } }; int ExpectedRows = NewBoard.Rows; int ExpectedColumns = NewBoard.Columns; Assert.AreEqual(ExpectedRows, 3); Assert.AreEqual(ExpectedColumns, 3); }
public void InfiniteBoardTestDoAll() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(0, 0); world.AddCell(0, 1); world.AddCell(0, -1); world.DoAll(); Assert.AreEqual(false, world.CellDoesExist(0, 1)); Assert.AreEqual(false, world.CellDoesExist(0, -1)); Assert.AreEqual(true, world.CellDoesExist(1, 0)); Assert.AreEqual(true, world.CellDoesExist(-1, 0)); }
public void InfiniteBoardEnsureICanCreateInstance() { InfiniteBoard world = new InfiniteBoard(); Assert.IsNotNull(world); }
public void InfiniteBoardCellDoesExist() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(0, 0); Assert.IsTrue(world.CellDoesExist(0, 0)); }
public void InfiniteBoardTestRemoveCell() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(0, 0); world.RemoveCell(0, 0); Assert.IsFalse(world.CellDoesExist(0, 0)); Assert.AreEqual(0, world.CellCount()); }
public void InfiniteBoardTestDoOneCellWithDeadCell() { InfiniteBoard world = new InfiniteBoard(); world.AddCell(1, 0); world.AddCell(0, 1); world.AddCell(1, 1); world.DoOneCell(0, 0); Assert.AreEqual(true, world.CellDoesExist(0, 0)); }
public void CanCreateABoard() { InfiniteBoard NewBoard = new InfiniteBoard(); Assert.IsNotNull(NewBoard); }
public void BoardDoesntResizeWhenNoLiveElementOnEdge() { InfiniteBoard board = new InfiniteBoard(new bool[,] { { false } }); bool[,] expected = new bool[,] { { false } }; CollectionAssert.AreEqual(expected, board.CurrentBoard); }