public void CardIsLessThan() { IComparable card1 = new Card(Rank.Ace, Suit.Clubs); IComparable card2 = new Card(Rank.Two, Suit.Diamonds); var result = card1.CompareTo(card2); Assert.IsTrue(result < 0); }
public void CardsAreEqual() { IComparable card1 = new Card(Rank.Ace, Suit.Clubs); IComparable card2 = new Card(Rank.Ace, Suit.Diamonds); var result = card1.CompareTo(card2); Assert.AreEqual(result, 0); }
public void HaveOneCardReturnsCardAsString() { var card = new Card(Rank.Ace, Suit.Clubs); var hand = new Hand(); hand.AddCard(card); Assert.AreEqual(hand.ToString(), card.ToString()); }
public void HaveTwoCardsReturnsTwoCommaSeparatedCardsInAscendingOrderAsString() { var card1 = new Card(Rank.Three, Suit.Clubs); var card2 = new Card(Rank.Two, Suit.Clubs); var hand = new Hand(); hand.AddCard(card1); hand.AddCard(card2); Assert.AreEqual(hand.ToString(), card2.ToString() + ", " + card1.ToString()); }
public void ReturnsAceOfClubsString() { var card = new Card(Rank.Ace, Suit.Clubs); var result = card.ToString(); Assert.AreEqual(result, "A♣"); }
public void ConstructorInitializeSuit() { var card = new Card(Rank.Ace, Suit.Clubs); Assert.AreEqual(card.Suit, Suit.Clubs); }
public void CompareWithWrongTypeThrows() { IComparable card1 = new Card(Rank.Ace, Suit.Clubs); var result = card1.CompareTo(new object()); }
public void CompareToNullThrows() { IComparable card1 = new Card(Rank.Ace, Suit.Clubs); var result = card1.CompareTo(null); }
public void ReturnTwoOfHeartsString() { var card = new Card(Rank.Two, Suit.Hearts); var result = card.ToString(); Assert.AreEqual(result, "2♥"); }
public void ReturnsTenOfDiamondsString() { var card = new Card(Rank.Ten, Suit.Diamonds); var result = card.ToString(); Assert.AreEqual(result, "10♦"); }
public void ReturnsKingOfSpadesString() { var card = new Card(Rank.Ten, Suit.Spades); var result = card.ToString(); Assert.AreEqual(result, "10♠"); }
public void IndexerReturnsOnZeroBasedIndex() { var card = new Card(Rank.Ace, Suit.Clubs); var hand = new Hand(); hand.AddCard(card); Assert.AreEqual(card, hand[0]); }
public void IndexerReturnsCardsInAscendingOrder() { var card1 = new Card(Rank.Three, Suit.Clubs); var card2 = new Card(Rank.Two, Suit.Clubs); var hand = new Hand(); hand.AddCard(card1); hand.AddCard(card2); Assert.AreEqual(card2, hand[0]); }
public void IndexerReturnsCardsByIndex() { var higherCardAdded = new Card(Rank.King, Suit.Clubs); var hand = new Hand(); hand.AddCard(higherCardAdded); hand.AddCard(new Card(Rank.Queen, Suit.Clubs)); hand.AddCard(new Card(Rank.Jack, Suit.Clubs)); Assert.AreEqual(higherCardAdded, hand[2]); }
public void AddCard(Card card) { _cards.Add(card); _cards.Sort(); }