コード例 #1
0
        public void Count_ThreeByThreeWithFourAliveNeighbors_ReturnsFour()
        {
            GameBoardCell[,] cells =
             {
            {
               Dead(), Alive(), Alive()
            },
            {
               Dead(), Alive(), Alive()
            },
            {
               Dead(), Dead(), Alive()
            }
             };
             var coordinates = new CellCoordinates
             {
            X = 1,
            Y = 1
             };

             var subject = new NeighborCounter();
             int count = subject.Count( cells, coordinates );

             count.Should().Be( 4 );
        }
コード例 #2
0
        public void Count_TwoByTwoWithTwoAliveNeighbors_ReturnsTwo()
        {
            GameBoardCell[,] cells =
             {
            {
               Dead(), Alive()
            },
            {
               Dead(), Alive()
            }
             };
             var coordinates = new CellCoordinates
             {
            X = 0, Y = 0
             };

             var subject = new NeighborCounter();
             int count = subject.Count( cells, coordinates );

             count.Should().Be( 2 );
        }