Exemplo n.º 1
0
        public void ReturnOneAliveCell_WhenRawFieldContainsOneAliveCell()
        {
            char[,] rawField = { { '*' } };
            var repository = new FieldRepository(rawField);

            var aliveCellsCount = repository.GetAliveCellsCount();

            Assert.AreEqual(1, aliveCellsCount);
        }
Exemplo n.º 2
0
        public void ReturnZeroAliveCells_WhenRAwFieldContainsOneDeadCell()
        {
            char[,] rawField = { { '.' } };
            var repository = new FieldRepository(rawField);

            var aliveCellsCount = repository.GetAliveCellsCount();

            Assert.AreEqual(0, aliveCellsCount);
        }
        public void ReturnEightAliveNeighboursCount_WhenPointInLeftUpperCorner_AndAllCellsAlive()
        {
            char[,] _field =
            {
                { '*', '*', '*' },
                { '*', '*', '*' },
                { '*', '*', '*' }
            };
            var _repository = new FieldRepository(_field);

            var aliveCellsCount = _repository.GetAliveCellsCountForPosition(new Point(0, 0));

            Assert.AreEqual(8, aliveCellsCount);
        }
        public void ReturnEightAliveNeighboursCount_WhenPointInLeftUpperCorner_AndOneDeadCellInNearPosition(
            int deadCellRow,
            int deadCellColumn)
        {
            char[,] _field =
            {
                { '*', '*', '*' },
                { '*', '*', '*' },
                { '*', '*', '*' }
            };
            _field[deadCellRow, deadCellColumn] = '.';
            var _repository = new FieldRepository(_field);

            var aliveCellsCount = _repository.GetAliveCellsCountForPosition(new Point(0, 0));

            Assert.AreEqual(8, aliveCellsCount);
        }