public void TestCellCloning() { var cell = new CenterCell(); cell.ShouldLive(); AbstractCell cloneCell = cell.Clone(); CompareClones(cell, cloneCell); }
public void TestCellBirth() { AbstractCell cell = new CenterCell(); cell.ShouldLive(); Assert.AreEqual(1, cell.CurrentGeneration); cell.ShouldLive(); Assert.AreEqual(2, cell.CurrentGeneration); }
public void TestCellNeighbourAccessibility() { var cell = new CenterCell(); Assert.AreEqual(true, cell.CanHaveBottom); Assert.AreEqual(true, cell.CanHaveBottomLeft); Assert.AreEqual(true, cell.CanHaveBottomRight); Assert.AreEqual(true, cell.CanHaveLeft); Assert.AreEqual(true, cell.CanHaveRight); Assert.AreEqual(true, cell.CanHaveTopLeft); Assert.AreEqual(true, cell.CanHaveTopRight); Assert.AreEqual(true, cell.CanHaveTop); }
public void TestClassicDieUnderPopulationRule() { IGameRule rule = new ClassicRule(); var cell = new CenterCell(); cell.ShouldLive(); Assert.AreEqual(true, cell.IsAlive); Assert.AreEqual(1, cell.CurrentGeneration); var cells = new List<AbstractCell> { new CenterCell(), new CenterCell(), new CenterCell(), new CenterCell() }; cells[0].ShouldLive(); rule.ApplyRule(cell, cells); Assert.AreEqual(false, cell.IsAlive); Assert.AreEqual(0, cell.CurrentGeneration); }
public void TestCellDeath() { var cell = new CenterCell(); cell.ShouldDie(); Assert.AreEqual(0, cell.CurrentGeneration); }