public void GetLiveCells_WithinputMatrix_ReturnsNotNull() { Mock <ConwayMatrixService> mockService = new Mock <ConwayMatrixService>(); int matrixRow = 2; int matrixCol = 1; int[,] matrix = new int[, ] { { 1, 0, 0, 0 }, { 0, 0, 1, 0 }, { 1, 1, 1, 0 }, { 0, 1, 0, 0 }, }; mockService.Setup(x => x.GetLiveCells(matrixRow, matrixCol, matrix)).Returns(1); _conwayMatrix = new ConwayMatrix(mockService.Object); _conwayMatrix.ActiveMatrix(matrix); Assert.IsNotNull(_conwayMatrix); }
public void GetCellsBehavior_WithinputElement_ReturnsLiveCell() { Mock <ConwayMatrixService> mockService = new Mock <ConwayMatrixService>(); int numberOfLiveCells = 2; int matrixElement = 1; int[,] matrix = new int[, ] { { 1, 0, 0, 0 }, { 0, 0, 1, 0 }, { 1, 1, 1, 0 }, { 0, 1, 0, 0 }, }; mockService.Setup(x => x.GetCellsBehaviour(matrixElement, numberOfLiveCells)).Returns(1); _conwayMatrix = new ConwayMatrix(mockService.Object); _conwayMatrix.ActiveMatrix(matrix); Assert.IsNotNull(_conwayMatrix); }
static void Main(string[] args) { bool endgame = false; var container = new UnityContainer(); int[,] matrix = new int[, ] { { 1, 0, 0, 0 }, { 0, 0, 1, 0 }, { 1, 1, 1, 0 }, { 0, 1, 0, 0 }, }; ConwayMatrix conwayMatrix = new ConwayMatrix(new ConwayMatrixService()); while (endgame == false) { Console.WriteLine(); conwayMatrix.ActiveMatrix(matrix); } }