Example #1
0
        public void GetNextState__Neighbours_1Red_6Green_2Blue__CellBecomesGreen()
        {
            var deadCell  = CellTestHelper.MakeDeadRGBCell();
            var redCell   = CellTestHelper.MakeRedRGBCell();
            var greenCell = CellTestHelper.MakeGreenRGBCell();
            var blueCell  = CellTestHelper.MakeBlueRGBCell();

            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(1, 6, 2);

            CellTestHelper.EvolveCell(deadCell, deadNeighbours);
            CellTestHelper.EvolveCell(redCell, deadNeighbours);
            CellTestHelper.EvolveCell(greenCell, deadNeighbours);
            CellTestHelper.EvolveCell(blueCell, deadNeighbours);

            Assert.IsTrue(deadCell.CurrentState == State.GREEN);
            Assert.IsTrue(redCell.CurrentState == State.GREEN);
            Assert.IsTrue(greenCell.CurrentState == State.GREEN);
            Assert.IsTrue(blueCell.CurrentState == State.GREEN);
        }
Example #2
0
        public void GetNextState__Neighbours_3Red_2Green_4Blue__CellBecomesBlue()
        {
            var deadCell  = CellTestHelper.MakeDeadRGBCell();
            var redCell   = CellTestHelper.MakeRedRGBCell();
            var greenCell = CellTestHelper.MakeGreenRGBCell();
            var blueCell  = CellTestHelper.MakeBlueRGBCell();

            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(3, 2, 4);

            CellTestHelper.EvolveCell(deadCell, deadNeighbours);
            CellTestHelper.EvolveCell(redCell, deadNeighbours);
            CellTestHelper.EvolveCell(greenCell, deadNeighbours);
            CellTestHelper.EvolveCell(blueCell, deadNeighbours);

            Assert.IsTrue(deadCell.CurrentState == State.BLUE);
            Assert.IsTrue(redCell.CurrentState == State.BLUE);
            Assert.IsTrue(greenCell.CurrentState == State.BLUE);
            Assert.IsTrue(blueCell.CurrentState == State.BLUE);
        }
Example #3
0
        public void GetNextState_0LiveNeighbours_CellStateDoesNotChange()
        {
            var deadCell  = CellTestHelper.MakeDeadRGBCell();
            var redCell   = CellTestHelper.MakeRedRGBCell();
            var greenCell = CellTestHelper.MakeGreenRGBCell();
            var blueCell  = CellTestHelper.MakeBlueRGBCell();

            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(0, 0, 0);

            CellTestHelper.EvolveCell(deadCell, deadNeighbours);
            CellTestHelper.EvolveCell(redCell, deadNeighbours);
            CellTestHelper.EvolveCell(greenCell, deadNeighbours);
            CellTestHelper.EvolveCell(blueCell, deadNeighbours);

            Assert.IsTrue(deadCell.CurrentState == State.DEAD);
            Assert.IsTrue(redCell.CurrentState == State.RED);
            Assert.IsTrue(greenCell.CurrentState == State.GREEN);
            Assert.IsTrue(blueCell.CurrentState == State.BLUE);
        }