ScoreTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Breakout.Tests ScoreTests

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

public class ScoreTests : TestWithMocksOrVisually

The ScoreTests type exposes the following members.

Constructors

  NameDescription
Public methodScoreTests
Initializes a new instance of the ScoreTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodIncreasePoints
Public methodInit
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLoseLivesUntilGameOver
Public methodNextLevelWithLevelInitialization
Public methodNextLevelWithoutInitialization
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
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 IncreasePoints()
{
    Assert.IsTrue(score.ToString().Contains("Score: 0"), score.ToString());
    score.IncreasePoints();
}
[Test]
public void NextLevelWithoutInitialization()
{
    bool isGameOver = false;
    score.GameOver += () => isGameOver = true;
    Assert.AreEqual(1, score.Level);
    score.NextLevel();
    Assert.AreEqual(2, score.Level);
    Assert.IsFalse(isGameOver);
}
[Test]
public void NextLevelWithLevelInitialization()
{
    Resolve<Level>();
    bool isGameOver = false;
    score.GameOver += () => isGameOver = true;
    Assert.AreEqual(1, score.Level);
    score.NextLevel();
    Assert.AreEqual(2, score.Level);
    Assert.IsFalse(isGameOver);
}
[Test]
public void LoseLivesUntilGameOver()
{
    bool isGameOver = false;
    score.GameOver += () => isGameOver = true;
    score.LifeLost();
    score.LifeLost();
    score.LifeLost();
    Assert.IsTrue(isGameOver);
}
See Also