コード例 #1
0
        public void BoundedApplyUnderPopulationToOneCell()
        {
            BoundedWorld world = new BoundedWorld(10, 10);
            world.AddCell(4, 5);

            world.UnderPopulationRule();
            world.Tick();

            Assert.AreEqual(0, world.AliveCellCount());
        }
コード例 #2
0
        public void BoundedEnsureThereAreCells()
        {
            int width = 80;
            int height = 80;
            BoundedWorld instance = new BoundedWorld(width, height);

            int x = 4;
            int y = 3;
            instance.AddCell(x, y);

            Assert.AreEqual(1, instance.AliveCellCount());
        }
コード例 #3
0
        public void BoundedWorldEnsureThereAreZeroLiveNeighbors()
        {
            // Arrange
            BoundedWorld my_world = new BoundedWorld(10, 10);

            // Act
            int expected_alive_neighbors = 0;
            int actual_alive_neighbors = my_world.AliveNeighborCount(4,5);

            // Assert
            Assert.AreEqual(expected_alive_neighbors, my_world.AliveCellCount());
        }
コード例 #4
0
        public void BoundedWorldApplyUnderPopulationToOneCell()
        {
            // Arrange
            BoundedWorld my_world = new BoundedWorld(10, 10);
            my_world.AddCell(4, 5);

            // Act
            my_world.UnderPopulationRule();

            // Assert
            Assert.AreEqual(0, my_world.AliveCellCount());
        }
コード例 #5
0
        public void BoundedWorldEnsureWorldHasCells()
        {
            int height = 100;
            int width = 100;
            BoundedWorld world = new BoundedWorld(width, height);

            int expected_number_of_dead_cells = 10000;
            int expected_number_of_live_cells = 0;
            int actual_number_of_live_cells = world.AliveCellCount();
            int actual_number_of_dead_cells = world.DeadCellCount();

            Assert.AreEqual(expected_number_of_dead_cells, actual_number_of_dead_cells);
            Assert.AreEqual(expected_number_of_live_cells, actual_number_of_live_cells);
        }
コード例 #6
0
        public void BoundedWorldEnsureThereAreCells()
        {
            // Arrange
            int width = 80;
            int height = 80;
            BoundedWorld my_world = new BoundedWorld(width, height);

            // Act
            int x = 4;
            int y = 3;
            my_world.AddCell(x,y);

            // Assert
            Assert.AreEqual(1, my_world.AliveCellCount());
        }
コード例 #7
0
        public void BoundedWorldApplyUnderPopulationToOneCell()
        {
            /* Begin Arrange */
            BoundedWorld my_world = new BoundedWorld(10, 10);
            my_world.AddCell(4, 5);
            /* End Arrange */

            /* Begin Act */
            my_world.UnderPopulationRule();
            my_world.Tick();
            /* End Act */

            /* Begin Assert */
            Assert.AreEqual(0, my_world.AliveCellCount());
            /* End Assert */
        }
コード例 #8
0
        public void BoundedWorldEnsureThereAreCells()
        {
            /* Begin Arrange */
            int width = 80;
            int height = 80;
            BoundedWorld my_world = new BoundedWorld(width, height);
            /* End Arrange */

            /* Begin Act */
            int x = 4;
            int y = 3;
            my_world.AddCell(x, y);
            /* End Act */

            /* Begin Assert */
            Assert.AreEqual(1, my_world.AliveCellCount());
            /* End Assert */
        }
コード例 #9
0
        public void BoundedWorldEnsureWorldHasCells()
        {
            /* Begin Arrange */
            int height = 100;
            int width = 100;
            BoundedWorld my_world = new BoundedWorld(width, height);
            /* End Arrange */

            /* Begin Act */
            int expected_number_of_dead_cells = 10000;
            int expected_number_of_alive_cells = 0;
            int actual_number_of_dead_cells = my_world.DeadCellCount();
            int actual_number_of_alive_cells = my_world.AliveCellCount();
            /* End Act */

            /* Begin Assert */
            Assert.AreEqual(expected_number_of_dead_cells, actual_number_of_dead_cells);
            Assert.AreEqual(expected_number_of_alive_cells, actual_number_of_alive_cells);
            /* End Assert */
        }