コード例 #1
0
        public void Neighbors_GivenLocationWithEightCellsBordering_ReturnsEight()
        {
            // arrange
            for (int x = 0; x < 3; ++x)
            {
                for (int y = 0; y < 3; ++y)
                {
                    universe.Add(x, y);
                }
            }

            // act
            int neighbors = universe.CountLivingNeighbors(1, 1);

            // assert
            Assert.AreEqual(
                expected: 8,
                actual: neighbors,
                message: "The cell did not have exactly 8 neighbors.");
        }