public void GameStateAnalyzer_UnplayedCardsBeatMyCards_False()
        {
            var playerMock = new Mock <IPlayer>();

            playerMock.Setup(m => m.Cards).Returns(new List <SheepCard>()
            {
                SheepCard.KING_SPADES,
                SheepCard.ACE_DIAMONDS,
                SheepCard.N7_DIAMONDS,
                SheepCard.ACE_SPADES
            });
            var cardsPlayed1 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_HEARTS },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.JACK_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.JACK_SPADES },
            };
            var cardsPlayed2 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.JACK_HEARTS },
                { new Mock <IPlayer>().Object, SheepCard.JACK_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N10_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.KING_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N9_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N8_DIAMONDS },
            };
            var cardsPlayed3 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.N8_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.N7_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.N8_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.KING_HEARTS }
            };
            var trickMock1 = new Mock <ITrick>();
            var trickMock2 = new Mock <ITrick>();
            var trickMock3 = new Mock <ITrick>();

            trickMock1.Setup(m => m.CardsByPlayer).Returns(cardsPlayed1);
            trickMock2.Setup(m => m.CardsByPlayer).Returns(cardsPlayed2);
            trickMock3.Setup(m => m.CardsByPlayer).Returns(cardsPlayed3);
            var allTricks = new List <ITrick>()
            {
                trickMock1.Object,
                trickMock2.Object,
                trickMock3.Object
            };

            trickMock3.Setup(m => m.IHand.ITricks).Returns(allTricks);
            trickMock3
            .Setup(m => m.IsLegalAddition(It.IsAny <SheepCard>(), It.IsAny <IPlayer>()))
            .Returns((SheepCard c, IPlayer p) => c == SheepCard.KING_SPADES || c == SheepCard.ACE_SPADES);

            //Starting suite in the current trick is Spades.
            //All trump have been played or are in the current player's hand.
            //The most powerful unplayed spade is in the players hand.
            var analyzer = new GameStateAnalyzer();
            var actual   = analyzer.UnplayedCardsBeatMyCards(playerMock.Object, trickMock3.Object);

            Assert.AreEqual(false, actual);
        }
        public void GameStateAnalyzer_UnplayedCardsBeatMyCards_PlayerMayPlayTrump_True()
        {
            var playerMock = new Mock <IPlayer>();

            playerMock.Setup(m => m.Cards).Returns(new List <SheepCard>()
            {
                SheepCard.KING_HEARTS,
                SheepCard.ACE_DIAMONDS,
                SheepCard.N7_CLUBS,
                SheepCard.N9_CLUBS
            });
            var cardsPlayed1 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.ACE_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_HEARTS },
                { new Mock <IPlayer>().Object, SheepCard.QUEEN_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.KING_CLUBS },
            };
            var cardsPlayed2 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.ACE_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.N10_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.KING_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N9_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N8_DIAMONDS },
                { new Mock <IPlayer>().Object, SheepCard.N7_DIAMONDS },
            };
            var cardsPlayed3 = new Dictionary <IPlayer, SheepCard>()
            {
                { new Mock <IPlayer>().Object, SheepCard.N8_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.N7_SPADES },
                { new Mock <IPlayer>().Object, SheepCard.N8_CLUBS },
                { new Mock <IPlayer>().Object, SheepCard.ACE_HEARTS }
            };
            var trickMock1 = new Mock <ITrick>();
            var trickMock2 = new Mock <ITrick>();
            var trickMock3 = new Mock <ITrick>();

            trickMock1.Setup(m => m.CardsByPlayer).Returns(cardsPlayed1);
            trickMock2.Setup(m => m.CardsByPlayer).Returns(cardsPlayed2);
            trickMock3.Setup(m => m.CardsByPlayer).Returns(cardsPlayed3);
            var allTricks = new List <ITrick>()
            {
                trickMock1.Object,
                trickMock2.Object,
                trickMock3.Object
            };

            trickMock3.Setup(m => m.IHand.ITricks).Returns(allTricks);
            trickMock3.Setup(m => m.IsLegalAddition(It.IsAny <SheepCard>(), It.IsAny <IPlayer>())).Returns(true);

            //Starting suite in the current trick is Spades.
            //All the jacks are currently unplayed.
            //Jacks beat ace of diamonds.
            var analyzer = new GameStateAnalyzer();
            var actual   = analyzer.UnplayedCardsBeatMyCards(playerMock.Object, trickMock3.Object);

            Assert.AreEqual(true, actual);
        }