public void ReturnsResultOfWinningCheckWhenTakingTurn() { MockBoard mockBoard = new MockBoard(5, true); Player player = new Player("Sam", mockBoard, new MockDice()); Assert.True(player.TakeTurn(MockConsole.Empty())); }
public void AddsCurrentPositionAndDiceRollTogether() { MockConsole mockConsole = MockConsole.Empty(); Board board = new Board(mockConsole, 100); Assert.AreEqual(6, board.CalculateNewPosition(1, 5)); mockConsole.AssertTextWasPrinted("You hop along to square 6"); }
public void IfItHitsASnakeItGoesDownIt() { MockConsole mockConsole = MockConsole.Empty(); Board board = new Board(mockConsole, 100, new Snake(6, 3)); Assert.AreEqual(3, board.CalculateNewPosition(2, 4)); mockConsole.AssertTextWasPrinted("You slide down a snake and plummet to square 3"); }
public void IfItHitsALadderItGoesUpIt() { MockConsole mockConsole = MockConsole.Empty(); Board board = new Board(mockConsole, 100, new Ladder(6, 12)); Assert.AreEqual(12, board.CalculateNewPosition(1, 5)); mockConsole.AssertTextWasPrinted("You climb up a ladder and ascend to square 12"); }
public void SetsPositionUsingTheBoard() { Player player = new Player("Manoj", new MockBoard(5), new MockDice()); player.TakeTurn(MockConsole.Empty()); Assert.AreEqual(5, player.CurrentPosition()); }
public void ChecksIfTheyHaveWonAfterTheirTurnUsingTheirFinalPosition() { MockBoard mockBoard = new MockBoard(5); Player player = new Player("Sam", mockBoard, new MockDice()); player.TakeTurn(MockConsole.Empty()); mockBoard.AssertWinCheckedForPosition(5); }
public void AsksThePlayerToRollTheDice() { Player player = new Player("Manoj", new MockBoard(), new MockDice()); MockConsole mockConsole = MockConsole.Empty(); player.TakeTurn(mockConsole); mockConsole.AssertTextWasPrinted("\n\n=> Manoj, press enter to roll the dice."); }
public void PromptsUserToPressEnterWhenTakingTurn() { Player player = new Player("Sam", new MockBoard(), new MockDice()); MockConsole mockConsole = MockConsole.Empty(); player.TakeTurn(mockConsole); mockConsole.AssertRead(); }
public void PassesDiceRollIntoBoard() { MockBoard mockBoard = new MockBoard(5); Player player = new Player("Manoj", mockBoard, new MockDice(3)); player.TakeTurn(MockConsole.Empty()); mockBoard.AssertNewPositionCalculatedWithDiceRoll(3); }
public void ItUsesTheBoardToCalculateItsNewPosition() { MockBoard mockBoard = new MockBoard(); Player player = new Player("Manoj", mockBoard, new MockDice()); player.TakeTurn(MockConsole.Empty()); mockBoard.AssertNewPositionCalculatedWithPreviousPosition(1); }
public void ItPrintsOutTheDiceRoll() { MockConsole mockConsole = MockConsole.Empty(); MockDice mockDice = new MockDice(2); Player player = new Player("Sam", new MockBoard(), mockDice); player.TakeTurn(mockConsole); mockConsole.AssertTextWasPrinted("You rolled a 2!"); }
public void PassesCurrentPositionIntoBoard() { MockBoard mockBoard = new MockBoard(5); Player player = new Player("Manoj", mockBoard, new MockDice()); player.TakeTurn(MockConsole.Empty()); player.TakeTurn(MockConsole.Empty()); mockBoard.AssertNewPositionCalculatedWithPreviousPosition(5); }
public void IfPlayerGetsToTheEndThenTheyWin() { Board board = new Board(MockConsole.Empty(), 100); Assert.True(board.HasWon(100)); }