Namespace: Drench.Logics
Assembly: Drench (in Drench.exe) Version: 1.1.1.0 (1.1.1)
Tests: Drench.Tests.Logics.TwoPlayerLogicTests
Tests: Drench.Tests.Logics.SinglePlayerLogicTests
5 unit tests call Drench.Logics.Logic.GetPlayerScore(System.Int32)
2 unit tests call Drench.Logics.Logic.GetPlayerScore(System.Int32)
Assembly: Drench (in Drench.exe) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- player
- Type: System Int32
Return Value
Type: Int32Remarks
Remarks
Examples
[Test] public void FirstMoveChangesTopLeftColorAndActivePlayer() { bool isGameFinished = false; logic.GameFinished += () => isGameFinished = true; logic.MakeMove(Color.Red); Assert.AreEqual(Color.Red, logic.Board.GetColor(0, 0)); Assert.IsFalse(isGameFinished); Assert.AreEqual(1, logic.ActivePlayer); Assert.AreEqual(1, logic.GetPlayerScore(0)); }
[Test] public void SecondMoveChangesBottomRightColorAndActivePlayer() { bool isGameFinished = false; logic.GameFinished += () => isGameFinished = true; logic.MakeMove(Color.Red); logic.MakeMove(Color.Green); Assert.AreEqual(Color.Green, logic.Board.GetColor(BoardTests.Width - 1, BoardTests.Height - 1)); Assert.IsFalse(isGameFinished); Assert.AreEqual(0, logic.ActivePlayer); Assert.AreEqual(1, logic.GetPlayerScore(1)); }
[Test] public void ThirdMoveChangesTopLeftColorAndActivePlayer() { bool isGameFinished = false; logic.GameFinished += () => isGameFinished = true; logic.MakeMove(Color.Red); logic.MakeMove(Color.Green); logic.MakeMove(Color.Purple); Assert.AreEqual(Color.Purple, logic.Board.GetColor(0, 0)); Assert.IsFalse(isGameFinished); Assert.AreEqual(1, logic.ActivePlayer); Assert.AreEqual(1, logic.GetPlayerScore(0)); }
Examples
[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)); }
See Also