示例#1
0
        public void ShouldCellExistWhenWasAdded()
        {
            Board b = new Board();

            b.AddCell(1, 1);

            Assert.IsTrue(b.IsCellExist(1, 1));
        }
示例#2
0
        public void ShouldCellNoneExistWhenWasRemoved()
        {
            Board b = new Board();

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

            Assert.IsFalse(b.IsCellExist(1, 1));
        }
示例#3
0
        public void ShouldCellDieWhenIsLonely()
        {
            Board b = new Board();

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

            Assert.IsFalse(b.IsCellExist(1,1));
        }
示例#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));
        }
示例#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));
        }