Ejemplo n.º 1
0
        public void TestStaysAlive()
        {
            int[,] map = {
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0},
                {0, 0, 0, 1, 0},
                {0, 0, 1, 1, 0},
                {0, 0, 0, 0, 0}
            };

            Game game = new Game(map);

            game.Update();

            Assert.AreEqual(1, game.GetPoint(3, 3));
        }
Ejemplo n.º 2
0
        public void TestCreatesNew()
        {
            int[,] map = {
                {0, 0, 0, 0, 0},
                {0, 0, 1, 0, 0},
                {0, 0, 0, 1, 0},
                {0, 0, 1, 0, 0},
                {0, 0, 0, 0, 1}
            };

            Game game = new Game(map);

            game.Update();

            Assert.AreEqual(1, game.GetPoint(2, 2));
            Assert.AreEqual(1, game.GetPoint(3, 3));
        }
Ejemplo n.º 3
0
        public void TestDies()
        {
            int[,] map = {
                {1, 1, 1, 0, 1},
                {0, 0, 0, 0, 0},
                {0, 1, 1, 1, 0},
                {0, 0, 0, 0, 0},
                {1, 0, 0, 0, 1}
            };

            Game game = new Game(map);

            game.Update();

            Assert.AreEqual(0, game.GetPoint(0, 0));
            Assert.AreEqual(0, game.GetPoint(0, 2));
            Assert.AreEqual(0, game.GetPoint(2, 1));
            Assert.AreEqual(0, game.GetPoint(0, 4));
            Assert.AreEqual(0, game.GetPoint(4, 0));
            Assert.AreEqual(0, game.GetPoint(4, 4));
        }
Ejemplo n.º 4
0
 public static IGame Create(IView view, Size size)
 {
     int cells = GetCountCells(size);
     Game game = new Game(view, cells);
     game.Init(size);
     return game;
 }