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); }
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); }
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); }
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); }
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); }
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); }
public void TestMaxThirteenRounds() { var board = new GameBoard(); for (var i = 0; i < 20; i++) { board.DealRound(); } Assert.AreEqual(13, board.Rounds); }
public void TestInitialState() { var board = new GameBoard(); Assert.IsNotNull(board.Slot1); Assert.IsNotNull(board.Slot2); Assert.IsNotNull(board.Slot3); Assert.IsNotNull(board.Slot4); }
public void TestHighestCardStackInitial() { var board = new GameBoard(); Assert.IsNull(board.HighestValueCardStack); }
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()); }
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); }
public void TestHasNontrivialStackInitial() { var board = new GameBoard(); Assert.IsFalse(board.HasNontrivialStack); }