public void AnyLiveCellWithZeroNeighborsDies()
        {
            var game = new Game(3);
            game.GiveBirth(1, 1);

            game.Step();

            AssertThat.AreEqual(@"...
                                  ...
                                  ...", game);
        }
Example #2
0
        public void TestWithTwoNeighbors()
        {
            var game = new Game(3);
            game.GiveBirth(0, 0);
            game.GiveBirth(0, 1);
            game.GiveBirth(1, 1);

            game.Step();

            Assert.IsTrue(game.Cells[1, 1]);
        }
        public void AnyLiveCellWithThreeNeighborsLives()
        {
            var game = new Game(3);
            game.GiveBirth(0, 0);
            game.GiveBirth(0, 2);
            game.GiveBirth(2, 0);
            game.GiveBirth(1, 1);

            game.Step();

            Assert.IsTrue(game[1, 1].IsAlive);
        }
Example #4
0
        public void TestAllCellsWithThreeNeighbors()
        {
            var game = new Game(3);
            game.GiveBirth(0, 0);
            game.GiveBirth(2, 0);
            game.GiveBirth(0, 2);

            game.Step();

            var expected = new[,] {
                {false, false, false},
                {false, true, false},
                {false, false, false}
            };
            CollectionAssert.AreEqual(expected, game.Cells);
        }