Esempio n. 1
0
        public void SimplePlayer_GetMove()
        {
            var mainPlayer = new SimplePlayer(new Participant());
            var card1      = SheepCard.JACK_CLUBS;
            var card2      = SheepCard.N8_HEARTS;

            new List <SheepCard>()
            {
                card1, card2
            }.ForEach(c => mainPlayer.AddCard(c));
            var playerList = new List <IPlayer>()
            {
                new MockPlayer(), new MockPlayer(), mainPlayer, new MockPlayer(), new MockPlayer()
            };
            {
                var trickMock = GenerateTrickMock(playerList);
                trickMock.Setup(m => m.IsLegalAddition(card1, mainPlayer)).Returns(true);
                trickMock.Setup(m => m.IsLegalAddition(card2, mainPlayer)).Returns(false);
                var cardPlayed = mainPlayer.GetMove(trickMock.Object);
                Assert.AreEqual(card1, cardPlayed, "Since card1 is legal, that is the card simple player will play");
            }
            {
                var trickMock = GenerateTrickMock(playerList);
                trickMock.Setup(m => m.IsLegalAddition(card1, mainPlayer)).Returns(false);
                trickMock.Setup(m => m.IsLegalAddition(card2, mainPlayer)).Returns(true);
                var cardPlayed = mainPlayer.GetMove(trickMock.Object);
                Assert.AreEqual(card2, cardPlayed, "Since card2 is legal, that is the card simple player will play");
            }
        }