Exemplo n.º 1
0
        public void GetNextState__RedCell_Neighbours0Red0Green2Blue__CellStaysRed()
        {
            var          cell           = CellTestHelper.MakeRedCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(0, 0, 2);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.RED);
        }
Exemplo n.º 2
0
        public void GetNextState__DeadCell_Neighbours2Red2Green3Blue__CellBecomesBlue()
        {
            var          cell           = CellTestHelper.MakeDeadCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(2, 2, 3);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.BLUE);
        }
Exemplo n.º 3
0
        public void GetNextState__DeadCell_Neighbours3Red3Green3Blue__CellBecomesRedOrGreenOrBlue()
        {
            var          cell           = CellTestHelper.MakeDeadCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(3, 3, 3);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.RED || cell.CurrentState == State.GREEN || cell.CurrentState == State.BLUE);
        }
Exemplo n.º 4
0
        public void GetNextState__BlueCell_Neighbours0Red3Green0Blue__CellBecomesGreen()
        {
            var          cell           = CellTestHelper.MakeBlueCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(0, 3, 0);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.GREEN);
        }
Exemplo n.º 5
0
        public void GetNextState__BlueCell_Neighbours3Red2Green0Blue__CellStaysBlue()
        {
            var          cell           = CellTestHelper.MakeBlueCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(3, 2, 0);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.BLUE);
        }
Exemplo n.º 6
0
        public void GetNextState_LiveCell_8LiveNeighbours_StaysAlive()
        {
            var          cell            = CellTestHelper.MakeLiveViralCell();
            List <State> eightNeighbours = CellTestHelper.CreateConwayNeighboursList(8);

            CellTestHelper.EvolveCell(cell, eightNeighbours);
            Assert.IsTrue(cell.CurrentState == State.ALIVE);
        }
Exemplo n.º 7
0
        public void GetNextState__GreenCell_Neighbours2Red0Green3Blue__CellStaysGreen()
        {
            var          cell           = CellTestHelper.MakeGreenCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(2, 0, 3);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.GREEN);
        }
Exemplo n.º 8
0
        public void GetNextState__GreenCell_Neighbours3Red0Green0Blue__CellBecomesRed()
        {
            var          cell           = CellTestHelper.MakeGreenCyclicRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(3, 0, 0);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.RED);
        }
Exemplo n.º 9
0
        public void GetNextState_DeadCell_9LiveNeighbours_BecomesAlive()
        {
            var          cell           = CellTestHelper.MakeDeadViralCell();
            List <State> nineNeighbours = CellTestHelper.CreateConwayNeighboursList(9);

            CellTestHelper.EvolveCell(cell, nineNeighbours);
            Assert.IsTrue(cell.CurrentState == State.ALIVE);
        }
Exemplo n.º 10
0
        public void GetNextState_DeadCell_6LiveNeighbours_StaysDead()
        {
            var          cell          = CellTestHelper.MakeDeadViralCell();
            List <State> sixNeighbours = CellTestHelper.CreateConwayNeighboursList(6);

            CellTestHelper.EvolveCell(cell, sixNeighbours);
            Assert.IsTrue(cell.CurrentState == State.DEAD);
        }
Exemplo n.º 11
0
        public void GetNextState__Neighbours_4Red_2Green_4Blue__CellBecomesRedOrBlue()
        {
            var          cell           = CellTestHelper.MakeDeadRGBCell();
            List <State> deadNeighbours = CellTestHelper.CreateRGBNeighboursList(4, 2, 4);

            CellTestHelper.EvolveCell(cell, deadNeighbours);
            Assert.IsTrue(cell.CurrentState == State.RED || cell.CurrentState == State.BLUE);
        }
Exemplo n.º 12
0
        public void GetNextState_LiveCell_1LiveNeighbours_Dies()
        {
            var cell = CellTestHelper.MakeLiveCell();

            List <State> oneNeighbour = CellTestHelper.CreateConwayNeighboursList(1);

            CellTestHelper.EvolveCell(cell, oneNeighbour);

            Assert.IsTrue(cell.CurrentState == State.DEAD);
        }
Exemplo n.º 13
0
        public void GetNextState_DeadCell_0LiveNeighbours_Dies()
        {
            var cell = CellTestHelper.MakeDeadCell();

            List <State> zeroNeighbours = CellTestHelper.CreateConwayNeighboursList(0);

            CellTestHelper.EvolveCell(cell, zeroNeighbours);

            Assert.IsTrue(cell.CurrentState == State.DEAD);
        }
Exemplo n.º 14
0
        public void GetNextState_0LiveNeighbours_CellStateDoesNotChange()
        {
            var deadCell  = CellTestHelper.MakeDeadCyclicRGBCell();
            var redCell   = CellTestHelper.MakeRedCyclicRGBCell();
            var greenCell = CellTestHelper.MakeGreenCyclicRGBCell();
            var blueCell  = CellTestHelper.MakeBlueCyclicRGBCell();

            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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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);
        }