Inheritance Hierarchy
Drench.Tests.Logics SinglePlayerLogicTests
Namespace: Drench.Tests.Logics
Assembly: Drench.Tests (in Drench.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The SinglePlayerLogicTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SinglePlayerLogicTests | Initializes a new instance of the SinglePlayerLogicTests class |
Methods
Name | Description | |
---|---|---|
ActivePlayerIsZero | ||
GameIsNotFinishedAfterFirstMove | ||
GetColor | ||
MakeMove | ||
MakingMoveAfterGameFinishedThrowsException | ||
PassingDoesNothing | ||
ResetGame | ||
SetUp | ||
WhenBoardIsAllTheSameColorGameIsFinished |
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