Пример #1
0
        public void ShouldMoveTwoPlayers(int dice, int position)
        {
            //Arrange
            _playerCursorMock.
            SetupSequence(_ => _.Next()).
            Returns(_player1.Move(dice)).
            Returns(_player2.Move(dice));

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            _freeStop.OnStop    += FreeOnStop;
            _freeStop.OnPass    += FreeOnPass;
            _freezeEntry.OnStop += FreeOnStop;
            _freezeEntry.OnPass += FreeOnPass;

            //Act
            boardCursor.NextTurn();
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(position);
            boardCursor.Positions[_player2].Should().Be(position);
            _freeOnStopExecuted.Should().Be(2);
            _freeOnPassExecuted.Should().Be((dice - 1) * 2);
        }
Пример #2
0
        public void ShouldCountFreezeStops_WhenPassAndStop(
            int dice,
            int expectedPosition,
            int freezeOnStopCountExpected,
            int freezeOnPassCountExpected
            )
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Move(dice));

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            _freezeEntry.OnPass += FreezeOnPass;
            _freezeEntry.OnStop += FreezeOnStop;

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(expectedPosition);
            _freezeOnStopExecuted.Should().Be(freezeOnStopCountExpected);
            _freezeOnPassExecuted.Should().Be(freezeOnPassCountExpected);
        }
Пример #3
0
        public void ShouldFreeze_WhenThereIsAFreezeStop()
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Freeze);

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(3);
        }
Пример #4
0
        public void ShouldMovePlayerOnBoard(int totalDice, int destinationIndex)
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Move(totalDice));

            var boardCursor = new BoardCursor(
                _fivePlacesBoard,
                _playerCursorMock.Object);

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(destinationIndex);
        }