public void GameDisplay_setNull_get0x0()
        {
            GameDisplay display = new GameDisplay();
            World world = new World(null);
            display.SetWorld(world);

            Assert.AreEqual(display.Width, 0);
            Assert.AreEqual(display.Height, 0);
        }
        public void GameDisplay_setDimension4x5_get4x5()
        {
            GameDisplay display = new GameDisplay();
            World world = new World(new Dimension(4, 5));
            display.SetWorld(world);

            Assert.AreEqual(display.Width, 4);
            Assert.AreEqual(display.Height, 5);
        }
Exemple #3
0
        public Game(IGameConfig config, GameDisplay display)
        {
            if (display == null)
            {
                State = GameStateWrongDisplay;
                return;
            }

            _display = display;

            if (config == null || !config.IsGoodConfig())
            {
                State = GameStateWrongConfig;
                return;
            }

            _world = new World(config.GetDimension());
            _world.SetLiveCells(config.GetLiveCells());
            _display.SetWorld(_world);
        }