예제 #1
0
        public void PlayLowestGapMove_MovePossible_PlayMove()
        {
            // play 50 on 5
            var cards = new ReadOnlyCollection <int>(new List <int>
            {
                2,
                3,
                98,
                99,
                50
            });
            var rows = TestHelper.GetPreparedRows(4, 5, 97, 96);
            var comm = new List <(int, PlayerCommunication)>();
            var info = new PlayerInformation(1, 2, rows, comm);

            var expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                              new CardPlacement(RowOfCardsIdentifier.SecondRowUp, 50));

            var move = PlayerMoveRules.PlayLowestGapMove(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));
        }
예제 #2
0
        public void PlayLowestGapMove_OnlyOneMovePossible_PlaysPossibleMove()
        {
            // 13 should not go anywhere
            var cards = new ReadOnlyCollection <int>(new List <int>
            {
                1,
                2,
                98,
                99,
                49
            });
            var rows = TestHelper.GetPreparedRows(3, 4, 96, 97);
            var comm = new List <(int, PlayerCommunication)>
            {
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.FirstRowUp,
                                         PlayerCommunicationType.DoNotPlayHere)),
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.SecondRowUp,
                                         PlayerCommunicationType.DoNotPlayHere)),
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.FirstRowDown,
                                         PlayerCommunicationType.DoNotPlayHere)),
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.SecondRowDown,
                                         PlayerCommunicationType.DoNotPlayHere))
            };
            var info = new PlayerInformation(0, 2, rows, comm);

            var expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                              new CardPlacement(RowOfCardsIdentifier.SecondRowUp, 49));

            var move = PlayerMoveRules.PlayLowestGapMove(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));
        }