public void RoyalFlush_OneCardMissingInHand_NoMatch() { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.Ace), new Card(CardSuit.Clubs, CardRank.King), new Card(CardSuit.Clubs, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Jack) }; RoyalFlushRule rule = new RoyalFlushRule(); bool result = rule.IsMatch(cards); Assert.AreEqual(false, result); }
public void RoyalFlush_AllSameSuitNotCorrectRank_NoMatch() { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.King), new Card(CardSuit.Clubs, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Jack), new Card(CardSuit.Clubs, CardRank.Ten), new Card(CardSuit.Clubs, CardRank.Nine), new Card(CardSuit.Clubs, CardRank.Eight), new Card(CardSuit.Clubs, CardRank.Seven), }; RoyalFlushRule rule = new RoyalFlushRule(); bool result = rule.IsMatch(cards); Assert.AreEqual(false, result); }
public void RoyalFlush_CorrectRanksOtherSuit_NoMatch() { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.Ace), new Card(CardSuit.Hearts, CardRank.King), new Card(CardSuit.Clubs, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Jack), new Card(CardSuit.Clubs, CardRank.Ten), new Card(CardSuit.Clubs, CardRank.Nine), new Card(CardSuit.Clubs, CardRank.Eight) }; RoyalFlushRule rule = new RoyalFlushRule(); bool result = rule.IsMatch(cards); Assert.AreEqual(false, result); }
public void RoyalFlush_IsMatch_IsAMatchWithSevenCards() { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.Ace), new Card(CardSuit.Clubs, CardRank.King), new Card(CardSuit.Clubs, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Jack), new Card(CardSuit.Clubs, CardRank.Ten), new Card(CardSuit.Clubs, CardRank.Nine), new Card(CardSuit.Clubs, CardRank.Eight) }; RoyalFlushRule rule = new RoyalFlushRule(); bool result = rule.IsMatch(cards); Assert.AreEqual(true, result); }
static void Main(string[] args) { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.Ace), new Card(CardSuit.Diamonds, CardRank.Ace), new Card(CardSuit.Diamonds, CardRank.Queen), new Card(CardSuit.Hearts, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Queen), }; var royalFlushRule = new RoyalFlushRule() .SetNext(new ThreeOfAKindRule()) .SetNext(new TwoPairRule()) .SetNext(new HighEndRule()); var isMatch = royalFlushRule.IsMatch(cards); Console.WriteLine($"This is a match with: {isMatch.Rule}"); }
public void RoyalFlush_DoubleRoyalFlushWithDifferentSuit_IsAMatch() { List <Card> cards = new List <Card> { new Card(CardSuit.Clubs, CardRank.Ace), new Card(CardSuit.Clubs, CardRank.King), new Card(CardSuit.Clubs, CardRank.Queen), new Card(CardSuit.Clubs, CardRank.Jack), new Card(CardSuit.Clubs, CardRank.Ten), new Card(CardSuit.Diamonds, CardRank.Ace), new Card(CardSuit.Diamonds, CardRank.King), new Card(CardSuit.Diamonds, CardRank.Queen), new Card(CardSuit.Diamonds, CardRank.Jack), new Card(CardSuit.Diamonds, CardRank.Ten), }; RoyalFlushRule rule = new RoyalFlushRule(); bool result = rule.IsMatch(cards); Assert.AreEqual(true, result); }