Example #1
0
        public void WhenGivenDeadCellWithTooFewNeighbours_UpdateCell_CellRemainsDead()
        {
            Cell cell = new Cell(CellState.dead);

            Cell[] neighbours = GenerateNeighbours(2, 3);
            Domain.ICellService cellService = new Domain.CellService();

            CellState newState = cellService.GetNewCellState(cell, neighbours);

            Assert.True(newState == CellState.dead);
        }
Example #2
0
        public void WhenGivenDeadCellWithEnoughNeighbours_UpdateCell_CellBecomesAlive()
        {
            Cell cell = new Cell(CellState.dead);

            Cell[] neighbours = GenerateNeighbours(3, 3);
            Domain.ICellService cellService = new Domain.CellService();

            CellState newState = cellService.GetNewCellState(cell, neighbours);

            Assert.True(newState == CellState.alive);
        }
Example #3
0
        public void WhenGivenLiveCellWithTooManyNeighbours_UpdateCell_CellIsKilled()
        {
            Cell cell = new Cell(CellState.alive);

            Cell[] neighbours = GenerateNeighbours(4, 3);
            Domain.ICellService cellService = new Domain.CellService();

            CellState newState = cellService.GetNewCellState(cell, neighbours);

            Assert.True(newState == CellState.dead);
        }