Inheritance Hierarchy
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
The GameTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GameTests | Initializes a new instance of the GameTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Draw | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
KillingAllBricksShouldAdvanceToNextLevel | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
RemoveBallIfGameIsOver | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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