Пример #1
0
        public void nextGeneration__Test()
        {
            Canvas cvs = new Canvas();

            // gridSize , deadToLive , liveStillLive , Canvas
            GameOfLife.Model mc = new GameOfLife.Model(10, "3", "23", cvs);

            mc.cells[0, 1].isAlive = true;
            mc.cells[1, 1].isAlive = true;
            mc.cells[2, 1].isAlive = true;

            mc.nextGeneration();

            Assert.IsTrue(mc.cells[1, 0].isAlive);
            Assert.IsTrue(mc.cells[1, 1].isAlive);
            Assert.IsTrue(mc.cells[1, 2].isAlive);

            Assert.IsTrue(mc.cells[0, 1].isAlive == false);
            Assert.IsTrue(mc.cells[2, 2].isAlive == false);
        }
Пример #2
0
        /// <summary>
        ///  Metoda asynchroniczna klasy ViewModel odpowiedzialna za nastepna generacje komorek
        /// </summary>
        public async void Next()
        {
            await Task.Run(() => gameOfLifeModel.nextGeneration());

            gameOfLifeModel.PaintGrid();
        }