Ejemplo n.º 1
0
        public void ShouldCellExistWhenWasAdded()
        {
            Board b = new Board();

            b.AddCell(1, 1);

            Assert.IsTrue(b.IsCellExist(1, 1));
        }
Ejemplo n.º 2
0
        public void ShouldCellNoneExistWhenWasRemoved()
        {
            Board b = new Board();

            b.AddCell(1, 1);
            b.RemoveCell(1, 1);

            Assert.IsFalse(b.IsCellExist(1, 1));
        }
Ejemplo n.º 3
0
        public void ShouldCellDieWhenIsLonely()
        {
            Board b = new Board();

            b.AddCell(1,1);
            b.NextState();

            Assert.IsFalse(b.IsCellExist(1,1));
        }
Ejemplo n.º 4
0
        public void ShouldLivingCellDieWhenHasLessThanTwoNeighbours()
        {
            Board b = new Board();

            b.AddCell(2, 2);
            b.AddCell(3, 2);
            b.NextState();

            Assert.IsFalse(b.IsCellExist(2, 2));
        }
Ejemplo n.º 5
0
        public void ShouldLivingCellStillLiveWhenHasTwoOrThreeNeighbours()
        {
            // test for two neighbours
            Board b = new Board();

            b.AddCell(2, 2);
            b.AddCell(3, 2);
            b.AddCell(2, 3);
            b.NextState();

            Assert.IsTrue(b.IsCellExist(2, 2));

            // test for three neighbours
            b = new Board();

            b.AddCell(2, 2);
            b.AddCell(3, 2);
            b.AddCell(2, 3);
            b.AddCell(3, 3);
            b.NextState();

            Assert.IsTrue(b.IsCellExist(2, 2));
        }