GameManagerTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  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

public class GameManagerTests : TestWithMocksOrVisually

The GameManagerTests type exposes the following members.

Constructors

  NameDescription
Public methodGameManagerTests
Initializes a new instance of the GameManagerTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCreateGamaManager
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLeftClickInsideFirstGridIndexShouldReviveFirstCell
Public methodLeftClickOutsideTheGridShouldDoNothing
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodResetGame
Public methodResetGameAlsoStopSimulationWhenCurrentlyRunning
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Public methodRightClickInsideFirstGridIndexShouldKillFirstCell
Public methodRightClickOutsideTheGridShouldDoNothing
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSimulationIsNotRunningWhenStarted
Public methodSimulationRunsWithFourTickPerSecondWhenStarted
Public methodStopSimulation
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
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