Ejemplo n.º 1
0
        public void DoGameOfLifeIteration_ExpectedAndActualArraysAraEqual()
        {
            int[,] arrayForIteration = new int[10, 10]  {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
            };
            int[,] expectedArray = new int[10, 10]  {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
            };


            arrayForIteration = _sut.DoGameOfLifeIteration(arrayForIteration,
                                                           arrayForIteration.GetLength(0),
                                                           arrayForIteration.GetLength(1));

            Assert.Equal(arrayForIteration, expectedArray);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Method calls one iteration and increases iteration counter.
 /// </summary>
 public void Iteration()
 {
     PlaygroundGrid = _arrayChecker.DoGameOfLifeIteration(PlaygroundGrid, PlaygroundRows, PlaygroundColumns);
     IterationNumber++;
 }