Exemplo n.º 1
0
        public void Clear_RGBGridWithLiveCells_AllCellsBecomeDead()
        {
            var grid = new RGBGrid(4, false);

            var coords = new Dictionary <Point, State>
            {
                { new Point {
                      X = 1, Y = 1
                  }, State.RED },
                { new Point {
                      X = 1, Y = 2
                  }, State.GREEN },
                { new Point {
                      X = 3, Y = 3
                  }, State.BLUE }
            };

            grid.SetInitialCells(coords);

            int deadCellsBefore = GridTestHelper.GetStateCount(grid, State.DEAD);

            Assert.AreEqual(deadCellsBefore, 13);

            grid.Clear();

            var deadCellsAfter = GridTestHelper.GetStateCount(grid, State.DEAD);

            Assert.AreEqual(deadCellsAfter, grid.Data.Length);
        }
Exemplo n.º 2
0
        public void Clear_RGBGrid_CyclesResetToZero()
        {
            var grid = new RGBGrid(4, false);

            grid.Cycle();

            Assert.IsTrue(grid.Cycles == 1);
            grid.Clear();
            Assert.IsTrue(grid.Cycles == 0);
        }