예제 #1
0
        public void FieldCanHaveCellSet()
        {
            Field field = new Field(1, 1);
            field.SetCell(0, 0);

            Assert.IsTrue(field.GetCell(0, 0));
        }
예제 #2
0
        public void DeadCellWith3NeighboursLives()
        {
            Field field = new Field(3, 3);
            field.SetCell(0, 0);    //Neighbour
            field.SetCell(1, 0);    //Neighbour
            field.SetCell(2, 0);    //Neighbour

            field.Update();

            Assert.IsTrue(field.GetCell(1, 1));
        }
예제 #3
0
        public void CellWithEnoughNeighboursLives()
        {
            Field field = new Field(3, 3);
            field.SetCell(1, 1);    //Test cell
            field.SetCell(0, 0);    //Neighbour
            field.SetCell(1, 0);    //Neighbour

            field.Update();

            Assert.IsTrue(field.GetCell(1, 1));
        }
예제 #4
0
 public void FieldThrowsExceptionWhenSettingCellsBeyondWidth()
 {
     Field field = new Field(1, 1);
     Assert.IsFalse(field.GetCell(1, 0));
 }
예제 #5
0
 public void FieldThrowsExceptionWhenGettingCellsBeyondHeight()
 {
     Field field = new Field(1, 1);
     Assert.IsFalse(field.GetCell(0, 1));
 }
예제 #6
0
        public void FieldIsConstructedWithAllOffCells()
        {
            Field field = new Field(1, 1);

            Assert.IsFalse(field.GetCell(0, 0));
        }
예제 #7
0
        public void OvercrowdedCellDies()
        {
            Field field = new Field(3, 3);
            field.SetCell(1, 1);    //Test cell
            field.SetCell(0, 0);    //Neighbour
            field.SetCell(1, 0);    //Neighbour
            field.SetCell(2, 0);    //Neighbour
            field.SetCell(0, 1);    //Neighbour

            field.Update();

            Assert.IsFalse(field.GetCell(1, 1));
        }
예제 #8
0
        public void LonelyCellDies()
        {
            Field field = new Field(3, 3);
            field.SetCell(1, 1);

            field.Update();

            Assert.IsFalse(field.GetCell(1, 1));
        }