/// <summary> /// Gets the first specific amount if high cards from the hand. /// </summary> /// <param name="hand"> /// The hand from which to get the high card, presumes this hand is of type <see cref="HighCardHand"/>. /// </param> /// <param name="cardCount">The amount of high cards to get.</param> /// <returns> /// a Specific amount of high cards from the provided hand, if there are not enough cards in the hand <br/> /// empty cards will be added. /// </returns> internal static IEnumerable <Card> GetHighCards(Hand hand, int cardCount) { HighCardHand realHand = (HighCardHand)hand; List <Card> clone = new List <Card>(realHand.cards); while (clone.Count < cardCount) { clone.Add(Card.Empty); } return(clone.Take(cardCount)); }
public void HighCard_ReturnsAppropriateValue_TieBreaker() { var mockLeft = new Mock <IHand>(); mockLeft.SetupGet(p => p.Cards).Returns(CardSequences.DescendingHigher); var mockRight = new Mock <IHand>(); mockRight.SetupGet(p => p.Cards).Returns(CardSequences.Descending); var left = new HighCardHand(mockLeft.Object); var right = new HighCardHand(mockRight.Object); Assert.Equal(1, left.CompareTo(right)); Assert.Equal(0, right.CompareTo(right)); Assert.Equal(-1, right.CompareTo(left)); }
/// <summary> /// Gets the high card from a provided <see cref="Hand"/>. /// </summary> /// <param name="hand"> /// The hand from which to get the high card, presumes this hand is of type <see cref="HighCardHand"/>. /// </param> /// <returns> /// The highest card in the hand. /// </returns> internal static Card GetHighCard(Hand hand) { HighCardHand realHand = (HighCardHand)hand; return(realHand.cards[0]); }