Example #1
0
        public void WhenDead_ShouldBecomeAlive_WhenExactly3NeighboursAreAlive()
        {
            var           cell          = new Cell();
            Neighbourhood neighbourhood = NeighbourhoodFactory.MakeNeighbourhood(3);

            cell.Transition(neighbourhood);

            Assert.True(cell.IsAlive());
        }
Example #2
0
        public void WhenDead_ShouldRemainDead_WhenAliveNeighboursAreMoreThan3()
        {
            var           cell          = new Cell();
            Neighbourhood neighbourhood = NeighbourhoodFactory.MakeNeighbourhood(4);

            cell.Transition(neighbourhood);

            Assert.False(cell.IsAlive());
        }
Example #3
0
        public void WhenAlive_ShouldBecomeDead_WhenLessThan2NeighboursAreAlive()
        {
            var           cell          = new Cell(CellState.Alive);
            Neighbourhood neighbourhood = NeighbourhoodFactory.MakeNeighbourhood(1);

            cell.Transition(neighbourhood);

            Assert.False(cell.IsAlive());
        }