Пример #1
0
 public void TestCellCloning()
 {
     var cell = new CenterCell();
     cell.ShouldLive();
     AbstractCell cloneCell = cell.Clone();
     CompareClones(cell, cloneCell);
 }
Пример #2
0
 public void TestCellBirth()
 {
     AbstractCell cell = new CenterCell();
     cell.ShouldLive();
     Assert.AreEqual(1, cell.CurrentGeneration);
     cell.ShouldLive();
     Assert.AreEqual(2, cell.CurrentGeneration);
 }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }
Пример #5
0
 public void TestCellDeath()
 {
     var cell = new CenterCell();
     cell.ShouldDie();
     Assert.AreEqual(0, cell.CurrentGeneration);
 }