Inheritance Hierarchy
Drench.Tests.Logics TwoPlayerLogicTests
Namespace: Drench.Tests.Logics
Assembly: Drench.Tests (in Drench.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TwoPlayerLogicTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TwoPlayerLogicTests | Initializes a new instance of the TwoPlayerLogicTests class |
Methods
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)); }
[Test] public void GameOverWhenOnlyPlayerColorsRemain() { bool isGameFinished = false; logic.GameFinished += () => isGameFinished = true; SetFirstThreeColumnsToBlue(); SetNextThreeColumnsToGreen(); SetRemainingColumnsToRed(); logic.MakeMove(Color.Green); Assert.IsTrue(isGameFinished); Assert.AreEqual(6 * BoardTests.Height, logic.GetPlayerScore(0)); }
[Test] public void PassingChangesActivePlayer() { logic.Pass(); Assert.AreEqual(1, logic.ActivePlayer); }
[Test] public void PassingTwiceChangesActivePlayerBack() { logic.Pass(); logic.Pass(); Assert.AreEqual(0, logic.ActivePlayer); }
[Test] public void CreateFromBoardData() { logic = new TwoHumanLogic(BoardTests.CreateBoardData()); logic.MakeMove(Color.Red); Assert.AreEqual(Color.Red, logic.Board.GetColor(0, 0)); Assert.AreEqual(1, logic.ActivePlayer); Assert.AreEqual(2, logic.GetPlayerScore(0)); }
See Also