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 TestRuleCellNullException() { try { IGameRule rule = new ClassicRule(); rule.ApplyRule(null, new List<AbstractCell>()); } catch (Exception exception) { Assert.AreEqual("Value cannot be null.\r\nParameter name: cell", exception.Message); throw; } }
public void TestRuleNeighboursNullException() { try { IGameRule rule = new ClassicRule(); rule.ApplyRule(new CenterCell(), null); } catch (Exception exception) { Assert.AreEqual("Value cannot be null.\r\nParameter name: neighbours", exception.Message); throw; } }