Esempio n. 1
0
        public void TestDealHand()
        {
            var board = new GameBoard();
            board.DealRound();

            Assert.AreEqual(1, board.Slot1.Count);
            Assert.AreEqual(1, board.Slot2.Count);
            Assert.AreEqual(1, board.Slot3.Count);
            Assert.AreEqual(1, board.Slot4.Count);
            Assert.AreEqual(1, board.Rounds);
        }
Esempio n. 2
0
        public void IntegrationTestPlayGame()
        {
            var board = new GameBoard();
            board.MessageEvent += board_MessageEvent;
            board.StartGame();

            Assert.IsFalse(board.CanDeal);
            Assert.IsFalse(board.CanPlay);

            Assert.AreEqual(13, board.Rounds);
            Assert.IsTrue(board.Plays > 0);
        }
Esempio n. 3
0
        public void TestCanPlay()
        {
            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Eight, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();

            Assert.IsTrue(board.CanPlay);
        }
Esempio n. 4
0
        public void TestAllOneSuit()
        {
            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Eight, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();

            board.Play();

            Assert.AreEqual(3, board.ClearSlotCount);
            Assert.AreEqual(1, board.Slot2.Count);
        }
Esempio n. 5
0
        public void TestFirstClearCardStack()
        {
            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();

            board.Slot3.Pop();

            Assert.AreEqual(board.Slot3, board.FirstClearStack);
        }
Esempio n. 6
0
        public void TestSlot3And4ComparisonSlot4Lower()
        {
            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Spades))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Clubs))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();

            board.Play();

            Assert.AreEqual(1, board.ClearSlotCount);
            Assert.AreEqual(0, board.Slot4.Count);
        }
Esempio n. 7
0
        public void TestMaxThirteenRounds()
        {
            var board = new GameBoard();
            for (var i = 0; i < 20; i++)
            {
                board.DealRound();
            }

            Assert.AreEqual(13, board.Rounds);
        }
Esempio n. 8
0
 public void TestInitialState()
 {
     var board = new GameBoard();
     Assert.IsNotNull(board.Slot1);
     Assert.IsNotNull(board.Slot2);
     Assert.IsNotNull(board.Slot3);
     Assert.IsNotNull(board.Slot4);
 }
Esempio n. 9
0
 public void TestHighestCardStackInitial()
 {
     var board = new GameBoard();
     Assert.IsNull(board.HighestValueCardStack);
 }
Esempio n. 10
0
        public void TestHighestCardStack()
        {
            var highestCard = new PlayingCard(PlayingCard.CardFace.Eight, PlayingCard.CardSuit.Hearts);

            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Spades))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Spades))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Spades))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Spades))
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(highestCard)
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();
            board.DealRound();

            Assert.AreEqual(highestCard, board.HighestValueCardStack.Peek());
        }
Esempio n. 11
0
        public void TestHasNontrivialStackOneCard()
        {
            var mDeck = new Mock<IDeck<PlayingCard>>();
            mDeck.Setup(m => m.CardsLeft()).Returns(4);
            mDeck.SetupSequence(m => m.Deal())
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Three, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Five, PlayingCard.CardSuit.Hearts))
                .Returns(new PlayingCard(PlayingCard.CardFace.Two, PlayingCard.CardSuit.Hearts));
            var board = new GameBoard(mDeck.Object);
            board.DealRound();

            Assert.IsFalse(board.HasNontrivialStack);
        }
Esempio n. 12
0
 public void TestHasNontrivialStackInitial()
 {
     var board = new GameBoard();
     Assert.IsFalse(board.HasNontrivialStack);
 }