Esempio n. 1
0
        public void Grid1By4Enumerates_4Times()
        {
            int count = 0;
            Grid grid = new Grid(1, 4);
            foreach (Cell cell in grid)
            {
                count++;
            }

            Assert.AreEqual(4, count);
        }
Esempio n. 2
0
        public void Grid1By1Enumerates_1Time()
        {
            int count = 0;
            Grid grid = new Grid(1, 1);
            foreach (Cell cell in grid)
            {
                count++;
            }

            Assert.AreEqual(1, count);
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     grid = GridInitializationHelper.Get4By4gridWithAllDeadCells();
     rule = new BasicTwoDimensionalNeighbourCellRule(grid);
 }
Esempio n. 4
0
 public static void MyClassInitialize(TestContext testContext)
 {
     grid = GridInitializationHelper.Get4By4gridWithAllDeadCells();
 }
 /// <summary>
 /// In order to find the neighbours of a given cell in an optimized way, the rule must be aware of the structure in which it is contained.
 /// Hence there is a tight coupling between an implementation of a neighbour rule and a CellContainer.
 /// This implementation depends on the cells being contained in a Grid.
 /// </summary>
 /// <param name="grid">The Grid of cells</param>
 public BasicTwoDimensionalNeighbourCellRule(Grid grid)
 {
     this.grid = grid;
 }