SingleHumanGameTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Drench.Tests.Games SingleHumanGameTests

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

public class SingleHumanGameTests : TestWithMocksOrVisually

The SingleHumanGameTests type exposes the following members.

Constructors

  NameDescription
Public methodSingleHumanGameTests
Initializes a new instance of the SingleHumanGameTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCacheAndReuseButtonThemesToImprovePerformace
Public methodClickingSquareAfterGameOverExits
Public methodClickInvalidSquare
Public methodClickSquaresUntilGameOverShowsGameOver
Public methodClickValidSquare
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodNewGameInstructions
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void NewGameInstructions()
{
    Assert.AreEqual("Try to complete the grid in the lowest number of turns!",
        game.upperText.Text);
}
[Test, CloseAfterFirstFrame]
public void ClickInvalidSquare()
{
    var firstSquare = new Vector2D(ScreenSpace.Current.Left + Game.Border + 0.01f,
        ScreenSpace.Current.Top + Game.Border + 0.01f);
    ClickMouse(firstSquare);
    Assert.AreEqual("0 turns taken - Invalid Move!", game.upperText.Text);
}
[Test, CloseAfterFirstFrame]
public void ClickValidSquare()
{
    ClickMouse(Vector2D.Half);
    Assert.AreEqual("1 turn taken", game.upperText.Text);
}
[Test, CloseAfterFirstFrame]
public void ClickSquaresUntilGameOverShowsGameOver()
{
    ClickSquaresUntilGameOver();
}
[Test, CloseAfterFirstFrame]
public void ClickingSquareAfterGameOverExits()
{
    bool hasExited = false;
    game.Exited += () => hasExited = true;
    MakeMovesThatFinishGame();
    ClickMouse(Vector2D.Half);
    Assert.IsTrue(hasExited);
}
[Test, CloseAfterFirstFrame]
public void CacheAndReuseButtonThemesToImprovePerformace()
{
    var numberOfButtonThemesCreated = game.NumberOfButtonThemesCreated;
    ClickMouse(WinningMoves[0]);
    Assert.AreEqual(numberOfButtonThemesCreated, game.NumberOfButtonThemesCreated);
    ClickMouse(WinningMoves[1]);
    Assert.AreEqual(numberOfButtonThemesCreated, game.NumberOfButtonThemesCreated);
}
See Also