コード例 #1
0
        public void BoundedEnsureEdgeCellsHaveCorrectNeigbors()
        {
            BoundedWorld world = new BoundedWorld(10, 10);

            List<Cell> neighbors = world.GetNeighbors(0, 0);

            Assert.AreEqual(3, neighbors.Count);
        }
コード例 #2
0
        public void BoundedEnsureThereAreZeroNeighbors()
        {
            BoundedWorld world = new BoundedWorld(10, 10);

            int expected_alive_neighbors = 0;
            int actual_alive_neighbors = world.AliveNeighborCount(4, 5);

            Assert.AreEqual(expected_alive_neighbors, actual_alive_neighbors);
        }
コード例 #3
0
        public void BoundedApplyUnderPopulationToOneCell()
        {
            BoundedWorld world = new BoundedWorld(10, 10);
            world.AddCell(4, 5);

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

            Assert.AreEqual(0, world.AliveCellCount());
        }
コード例 #4
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());
        }
コード例 #5
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());
        }
コード例 #6
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());
        }
コード例 #7
0
        public void BoundedWorldEnsureEdgeCellsHaveCorrectNeighbors()
        {
            /* Begin Arrange */
            BoundedWorld my_world = new BoundedWorld(10, 10);
            /* End Arrange */

            /* Begin Act */
            List<Cell> neighbors = my_world.GetNeighbors(0, 0);
            /* End Act */

            /* Begin Assert */
            Assert.AreEqual(3, neighbors.Count);
            /* End Assert */
        }
コード例 #8
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);
        }
コード例 #9
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());
        }
コード例 #10
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 */
        }
コード例 #11
0
        public void BoundedWorldEnsureIHaveArrayOfCorrectSize()
        {
            // Arrange
            int height = 80;
            int width = 80;

            // Act
            BoundedWorld my_world = new BoundedWorld(width, height);
            int expected_height = height;
            int expected_width = width;

            int actual_height = my_world.Height;
            int actual_width = my_world.Width;

            // Assert
            Assert.AreEqual(expected_height, actual_height);
            Assert.AreEqual(expected_width, actual_width);
        }
コード例 #12
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 */
        }
コード例 #13
0
        public void BoundedWorldEnsureIHaveArrayOfCorrectSize()
        {
            /* Begin Arrange */
            int height = 80;
            int width = 80;
            BoundedWorld my_world = new BoundedWorld(width, height);
            int expected_height = height;
            int expected_width = width;
            /* End Arrange */

            /* Begin Act */
            int actual_height = my_world.Height;
            int actual_width = my_world.Width;
            /* End Act */

            /* Begin Assert */
            Assert.AreEqual(expected_height, actual_height);
            Assert.AreEqual(expected_width, actual_width);
            /* End Assert */
        }
コード例 #14
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 */
        }
コード例 #15
0
        public void BoundedWorldEnsureWorldIsSmallerThanMax()
        {
            /* Begin Arrange */
            int height = 80;
            int width = 80;
            /* End Arrange */

            /* Begin Act */
            BoundedWorld my_world = new BoundedWorld(width, height);
            /* End Act */

            /* Begin Assert */
            Assert.IsNotNull(my_world);
            /* End Assert */
        }
コード例 #16
0
        public void EnsureIHaveArrayOfCorrectSize()
        {
            int height = 80;
            int width = 80;
            BoundedWorld world = new BoundedWorld(width, height);
            int expected_height = height;
            int expected_width = width;

            int actual_height = world.Height;
            int actual_width = world.Width;

            Assert.AreEqual(expected_height, actual_height);
            Assert.AreEqual(expected_width, actual_width);
        }
コード例 #17
0
        public void BoundedWorldEnsureThereAreZeroLiveNeighbors()
        {
            /* Begin Arrange */
            BoundedWorld my_world = new BoundedWorld(10, 10);
            /* End Arrange */

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

            /* Begin Assert */
            Assert.AreEqual(expected_alive_neighbors, actual_alive_neighbors);
            /* End Assert */
        }
コード例 #18
0
        public void BoundedWorldEnsureWorldIsSmallerThanMax()
        {
            //Begin Arrange
            int height = 80;
            int width = 80;
            //End Arrange

            //Begin Act
            BoundedWorld world = new BoundedWorld(width, height);
            //End Act

            //Begin Assert
            Assert.IsNotNull(world);
            //End Assert
        }
コード例 #19
0
 public void WorldEnsureICanCreateInstance()
 {
     BoundedWorld my_world = new BoundedWorld();
     Assert.IsNotNull(my_world);
 }
コード例 #20
0
 public void EnsureICanCreateAnInstance()
 {
     BoundedWorld myInstance = new BoundedWorld();
     Assert.IsNotNull(myInstance);
 }
コード例 #21
0
        public void MyTestMethod()
        {
            /* Arrage */
            int height = 80;
            int width = 80;

            /* Act */
            BoundedWorld my_world = new BoundedWorld(width, height);

            /* Assert */
            Assert.IsNotNull(my_world);
        }