public void NexState_Should_ReturnDeadCell_If_DeadCellHasNoNeighbours() { var systemUnderTest = new CoreRule(); var cell = new Cell { Alive = false, }; var neighbours = new List <Cell>(); Cell cellInNextRound = systemUnderTest.NextState(cell, neighbours); cellInNextRound.Should().BeDead(); }
public void NextState_Should_ReturnDeadCell_If_LivingCellHasOneAliveNeighbour() { var systemUnderTest = new CoreRule(); var cell = new Cell { Alive = true, }; var neighbours = new List <Cell> { new() { Alive = true } }; Cell cellInNextRound = systemUnderTest.NextState(cell, neighbours); cellInNextRound.Should().BeDead(); }
public void NexState_Should_ThrowTooManyNeighboursException_If_MoreThanEightNeighborsAreGiven() { var systemUnderTest = new CoreRule(); var anyCell = new Cell(); var neighbours = new List <Cell> { new() { Alive = true }, new() { Alive = false }, new() { Alive = true }, new() { Alive = false }, new() { Alive = true }, new() { Alive = false }, new() { Alive = false }, new() { Alive = false }, new() { Alive = false }, }; Action throwingAction = () => systemUnderTest.NextState(anyCell, neighbours); throwingAction.Should().Throw <TooManyNeighboursException>(); }
public void NexState_Should_ReturnLivingCell_If_DeadCellHasThreeLivingAndFiveDeadNeighbours() { var systemUnderTest = new CoreRule(); var cell = new Cell { Alive = false, }; var neighbours = new List <Cell> { new() { Alive = true }, new() { Alive = false }, new() { Alive = true }, new() { Alive = false }, new() { Alive = true }, new() { Alive = false }, new() { Alive = false }, new() { Alive = false }, }; Cell cellInNextRound = systemUnderTest.NextState(cell, neighbours); cellInNextRound.Should().BeAlive(); }