Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
GameOfLife.Tests GameManagerTests
Namespace: GameOfLife.Tests
Assembly: GameOfLife.Tests (in GameOfLife.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The GameManagerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GameManagerTests | Initializes a new instance of the GameManagerTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void LeftClickOutsideTheGridShouldDoNothing() { manager.ReviveCellOnLeftClick(new Vector2D(.045f, .045f)); Assert.AreEqual(0, manager.gameOfLife.Population); }
[Test] public void LeftClickInsideFirstGridIndexShouldReviveFirstCell() { manager.ReviveCellOnLeftClick(new Vector2D(.273f, .273f)); Assert.IsTrue(manager.gameOfLife.IsCellAlive(0, 0)); Assert.AreEqual(1, manager.gameOfLife.Population); }
[Test] public void RightClickOutsideTheGridShouldDoNothing() { manager.gameOfLife.ReviveCellAtPosition(0, 0); manager.KillCellOnRightClick(new Vector2D(.045f, .045f)); Assert.AreEqual(1, manager.gameOfLife.Population); }
[Test] public void RightClickInsideFirstGridIndexShouldKillFirstCell() { manager.gameOfLife.ReviveCellAtPosition(0, 0); manager.KillCellOnRightClick(new Vector2D(.273f, .273f)); Assert.IsFalse(manager.gameOfLife.IsCellAlive(0, 0)); Assert.AreEqual(0, manager.gameOfLife.Population); }
[Test] public void SimulationIsNotRunningWhenStarted() { manager.Update(); Assert.AreEqual(0, manager.gameOfLife.Population); }
[Test] public void SimulationRunsWithFourTickPerSecondWhenStarted() { manager.StartOrStopSimulation(); Assert.IsTrue(manager.IsSimulationRunning); manager.Update(); AdvanceTimeAndUpdateEntities(1); Assert.GreaterOrEqual(manager.gameOfLife.Generation, 4); }
[Test] public void StopSimulation() { SimulationRunsWithFourTickPerSecondWhenStarted(); manager.StartOrStopSimulation(); Assert.IsFalse(manager.IsSimulationRunning); }
[Test] public void ResetGame() { manager.gameOfLife.ReviveCellAtPosition(0, 0); manager.ResetGame(); Assert.AreEqual(0, manager.gameOfLife.Population); Assert.AreEqual(0, manager.gameOfLife.Generation); }
[Test] public void ResetGameAlsoStopSimulationWhenCurrentlyRunning() { SimulationRunsWithFourTickPerSecondWhenStarted(); manager.ResetGame(); Assert.IsFalse(manager.IsSimulationRunning); }
See Also