GameTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Breakout.Tests GameTests

Namespace: Breakout.Tests
Assembly: Breakout.Tests (in Breakout.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class GameTests : TestWithMocksOrVisually

The GameTests type exposes the following members.

Constructors

  NameDescription
Public methodGameTests
Initializes a new instance of the GameTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodDraw
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodKillingAllBricksShouldAdvanceToNextLevel
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRemoveBallIfGameIsOver
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void Draw()
{
    Resolve<Paddle>();
    Resolve<RelativeScreenSpace>();
    new Game(Resolve<Window>());
}
[Test, CloseAfterFirstFrame]
public void RemoveBallIfGameIsOver()
{
    var score = Resolve<Score>();
    bool isGameOver = false;
    score.GameOver += () => isGameOver = true;
    score.LifeLost();
    score.LifeLost();
    score.LifeLost();
    Assert.IsTrue(isGameOver);
}
[Test, CloseAfterFirstFrame]
public void KillingAllBricksShouldAdvanceToNextLevel()
{
    bool isGameOver = false;
    var level = Resolve<Level>();
    var score = Resolve<Score>();
    Score remScore = score;
    remScore.GameOver += () => isGameOver = true;
    Assert.AreEqual(1, score.Level);
    DisposeAllBricks(level);
    Assert.AreEqual(0, level.BricksLeft);
    Assert.AreEqual(1, remScore.Level);
    Assert.IsFalse(isGameOver);
}
See Also