public void ThrowExceptionIfNumberOfCellsIsTwo() { Ecosystem ecosystem = new Ecosystem(); ecosystem.AddCell(0, 0); ecosystem.AddCell(0, 1); GameOfLife gameOfLife = new GameOfLife(ecosystem); Assert.Throws <Exception>(() => gameOfLife.Play()); }
public void ReturnNewPatternWhenYouIntroduceABeaconPattern() { Ecosystem expectedEcosystem = new Ecosystem(); expectedEcosystem.AddCell(0, 0); expectedEcosystem.AddCell(1, 0); expectedEcosystem.AddCell(0, 1); expectedEcosystem.AddCell(2, 3); expectedEcosystem.AddCell(3, 2); expectedEcosystem.AddCell(3, 3); Ecosystem ecosystem = new Ecosystem(); ecosystem.AddCell(0, 0); ecosystem.AddCell(0, 1); ecosystem.AddCell(1, 1); ecosystem.AddCell(1, 0); ecosystem.AddCell(2, 2); ecosystem.AddCell(2, 3); ecosystem.AddCell(3, 2); ecosystem.AddCell(3, 3); GameOfLife gameOfLife = new GameOfLife(ecosystem); gameOfLife.Play(); Assert.Equal(expectedEcosystem, ecosystem); }
public void KeepRevivedCellsWhenYouIntroduceThreeInARow() { Ecosystem expectedEcosystem = new Ecosystem(); expectedEcosystem.AddCell(1, 0); expectedEcosystem.AddCell(1, 1); expectedEcosystem.AddCell(1, -1); Ecosystem ecosystem = new Ecosystem(); ecosystem.AddCell(0, 0); ecosystem.AddCell(2, 0); ecosystem.AddCell(1, 0); GameOfLife gameOfLife = new GameOfLife(ecosystem); gameOfLife.Play(); Assert.Equal(expectedEcosystem, ecosystem); }
public void KeepAliveAllCellsWhenFirstGenerationIsASquare() { Ecosystem expectedEcosystem = new Ecosystem(); expectedEcosystem.AddCell(0, 0); expectedEcosystem.AddCell(0, 1); expectedEcosystem.AddCell(1, 1); expectedEcosystem.AddCell(1, 0); Ecosystem ecosystem = new Ecosystem(); ecosystem.AddCell(0, 0); ecosystem.AddCell(0, 1); ecosystem.AddCell(1, 1); ecosystem.AddCell(1, 0); GameOfLife gameOfLife = new GameOfLife(ecosystem); gameOfLife.Play(); Assert.Equal(expectedEcosystem, ecosystem); }