public void CardCompairToWeakerToStrongerCardsTest() { Card firstCard = new Card(CardFace.Three, CardSuit.Diamonds); Card secondCard = new Card(CardFace.Five, CardSuit.Hearts); int result = firstCard.CompareTo(secondCard); int expexted = -1; Assert.AreEqual(expexted, result, "Compairing weaker to stronger card returns wrong result."); }
public void CardCompairToEqualCardsTest() { Card firstCard = new Card(CardFace.Queen, CardSuit.Spades); Card secondCard = new Card(CardFace.Queen, CardSuit.Spades); int result = firstCard.CompareTo(secondCard); int expexted = 0; Assert.AreEqual(expexted, result, "Compairing equal cards returns they are not equal."); }
public void TestCompareQueenSpadesWithJackSpades() { Card firstCard = new Card(CardFace.Queen, CardSuit.Spades); Card secondCard = new Card(CardFace.Jack, CardSuit.Spades); int expectedResult = 1; int actualResult = firstCard.CompareTo(secondCard); Assert.AreEqual(expectedResult, actualResult); }
public void TestCompare2ClubsWithAceDimonds() { Card firstCard = new Card(CardFace.Two, CardSuit.Clubs); Card secondCard = new Card(CardFace.Ace, CardSuit.Diamonds); int expectedResult = -1; int actualResult = firstCard.CompareTo(secondCard); Assert.AreEqual(expectedResult, actualResult); }
public void TestCompare10SpadesWith10Dimonds() { Card firstCard = new Card(CardFace.Ten, CardSuit.Spades); Card secondCard = new Card(CardFace.Ten, CardSuit.Diamonds); int expectedResult = 0; int actualResult = firstCard.CompareTo(secondCard); Assert.AreEqual(expectedResult, actualResult); }
private static bool isStraightFlush(List <Card> h) { Card c = isStraight(h); Card f = isFlush(h); if (c == null || f == null) { return(false); } if (c.CompareTo(f) == 0) { return(true); } return(false); }
/* * two choices here, the pair is in the * front of the hand or in the back of the * hand, because it is sorted */ private static Card isFullHouse(List <Card> h) { Card triple = isThreeOfAKind(h); List <Card> l = null; l = h.Where(x => x != triple).ToList(); Card pair = isPair(l); if (triple == null || pair == null) { return(null); } if (pair.CompareTo(triple) != 0) { return(triple); } return(null); }