예제 #1
0
        public void GameStateAnalyzer_AllOpponentsHavePlayed_Defense_PartnerUnknown_Null()
        {
            var pickerMock  = new Mock <IPlayer>();
            var partnerMock = new Mock <IPlayer>();
            var playerMock  = new Mock <IPlayer>();

            playerMock.Setup(m => m.Cards).Returns(new List <SheepCard>());
            var cardsPlayed = new Dictionary <IPlayer, SheepCard>()
            {
                { pickerMock.Object, SheepCard.QUEEN_HEARTS },
                { new Mock <IPlayer>().Object, SheepCard.N8_DIAMONDS },
                { partnerMock.Object, SheepCard.JACK_CLUBS }
            };
            var trickMock = new Mock <ITrick>();

            trickMock.Setup(m => m.CardsByPlayer).Returns(cardsPlayed);
            trickMock.Setup(m => m.IHand.Picker).Returns(pickerMock.Object);
            trickMock.Setup(m => m.IHand.PartnerCardEnum).Returns(SheepCard.JACK_DIAMONDS);
            trickMock.Setup(m => m.IHand.PresumedParnter).Returns((IPlayer)null);
            trickMock.Setup(m => m.IHand.IGame.PlayerCount).Returns(5);
            var analyzer = new GameStateAnalyzer();
            var actual   = analyzer.AllOpponentsHavePlayed(playerMock.Object, trickMock.Object);

            Assert.AreEqual(null, actual);
        }
예제 #2
0
        public void GameStateAnalyzer_AllOpponentsHavePlayed_Offense_PartnerProbablyKnown_No()
        {
            var partnerCard = SheepCard.JACK_HEARTS;
            var partnerMock = new Mock <IPlayer>();
            var playerMock  = new Mock <IPlayer>();

            playerMock.Setup(m => m.Cards).Returns(new List <SheepCard>());
            var cardsPlayed = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.N8_DIAMONDS },
                { partnerMock.Object, SheepCard.N8_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.JACK_DIAMONDS },
            };
            var trickMock = new Mock <ITrick>();

            trickMock.Setup(m => m.CardsByPlayer).Returns(cardsPlayed);
            trickMock.Setup(m => m.IHand.Picker).Returns(playerMock.Object);
            trickMock.Setup(m => m.IHand.PresumedParnter).Returns(partnerMock.Object);
            trickMock.Setup(m => m.IHand.PartnerCardEnum).Returns(partnerCard);
            trickMock.Setup(m => m.IHand.Partner).Returns((IPlayer)null);
            trickMock.Setup(m => m.IHand.IGame.PlayerCount).Returns(5);
            var analyzer = new GameStateAnalyzer();
            var actual   = analyzer.AllOpponentsHavePlayed(playerMock.Object, trickMock.Object);

            Assert.AreEqual(false, actual);
        }