SinglePlayerLogicTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  Drench.Tests.Logics SinglePlayerLogicTests

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

public class SinglePlayerLogicTests

The SinglePlayerLogicTests type exposes the following members.

Constructors

  NameDescription
Public methodSinglePlayerLogicTests
Initializes a new instance of the SinglePlayerLogicTests class
Top
Methods

  NameDescription
Public methodActivePlayerIsZero
Public methodGameIsNotFinishedAfterFirstMove
Public methodGetColor
Public methodMakeMove
Public methodMakingMoveAfterGameFinishedThrowsException
Public methodPassingDoesNothing
Public methodResetGame
Public methodSetUp
Public methodWhenBoardIsAllTheSameColorGameIsFinished
Top
Examples

[Test]
public void ActivePlayerIsZero()
{
    Assert.AreEqual(0, logic.ActivePlayer);
}
[Test]
public void GetColor()
{
    Assert.AreEqual(new Color(0.5f, 1.0f, 1.0f), logic.Board.GetColor(0, 0));
}
[Test]
public void ResetGame()
{
    logic.Reset();
    Assert.AreEqual(new Color(1.0f, 1.0f, 0.5f), logic.Board.GetColor(0, 0));
}
[Test]
public void MakeMove()
{
    logic.MakeMove(Color.Red);
    Assert.AreEqual(Color.Red, logic.Board.GetColor(0, 0));
}
[Test]
public void GameIsNotFinishedAfterFirstMove()
{
    bool isGameFinished = false;
    logic.GameFinished += () => isGameFinished = true;
    logic.MakeMove(Color.Red);
    Assert.IsFalse(logic.IsGameOver);
    Assert.IsFalse(isGameFinished);
    Assert.AreEqual(1, logic.GetPlayerScore(0));
}
[Test]
public void WhenBoardIsAllTheSameColorGameIsFinished()
{
    bool isGameFinished = false;
    logic.GameFinished += () => isGameFinished = true;
    MakeWinningMove();
    Assert.IsTrue(logic.IsGameOver);
    Assert.IsTrue(isGameFinished);
    Assert.AreEqual(BoardTests.Width * BoardTests.Height, logic.GetPlayerScore(0));
}
[Test]
public void MakingMoveAfterGameFinishedThrowsException()
{
    MakeWinningMove();
    Assert.Throws<Logic.CannotMakeMoveWhenGameIsOver>(() => logic.MakeMove(Color.Red));
}
[Test]
public void PassingDoesNothing()
{
    logic.Pass();
}
See Also