public bool IsMatched(PokerDetail detail) { if (detail == null) { throw new System.ArgumentNullException(nameof(detail)); } return(detail.CardDetail.All(x => x.Value == 1)); }
public PokerHands GetPokerHands(PokerDetail detail) { foreach (var rule in _rules) { if (rule.IsMatched(detail)) { return(rule.CurrentPokerHand); } } // throw an error if there is no rule can match the detail throw new InvalidOperationException("Rules Missing, Check your rules first."); }