public void GetLiveCells_WithNullInput_ThrowsException()
        {
            _conwayMatrixService = new ConwayMatrixService();
            int matrixRow = 0;
            int matrixCol = 0;

            int[,] matrix = null;
            var liveCeels = _conwayMatrixService.GetLiveCells(matrixRow, matrixCol, matrix);
        }
        public void GetCellsBehavior_WithinputElement_ReturnsLiveCell()
        {
            _conwayMatrixService = new ConwayMatrixService();
            int numberOfLiveCells = 2;
            int matrixElement     = 1;

            var newCell = _conwayMatrixService.GetCellsBehaviour(matrixElement, numberOfLiveCells);

            Assert.IsTrue(newCell == 1);
        }
        public void GetLiveCells_WithinputMatrix_ReturnsZeroCells()
        {
            _conwayMatrixService = new ConwayMatrixService();
            int matrixRow = 0;
            int matrixCol = 0;

            int[,] matrix = new int[, ]
            {
                { 1, 0, 0, 0 },
                { 0, 0, 1, 0 },
                { 1, 1, 1, 0 },
                { 0, 1, 0, 0 },
            };
            var liveCeels = _conwayMatrixService.GetLiveCells(matrixRow, matrixCol, matrix);

            Assert.IsTrue(liveCeels == 0);
        }
 public ConwayMatrix(IConwayMatrixService conwayMatrixService)
 {
     _conwayMatrixService = conwayMatrixService;
 }
예제 #5
0
 public HomeController()
 {
     _conwayMatrixService = new ConwayMatrixService();
 }