示例#1
0
        public void AceAsOne()
        {
            var hand1 = new StraightFlush();

            hand1.SetCards(Cards.New()
                           .Ace(Suit.Clubs)
                           .Two(Suit.Clubs)
                           .Three(Suit.Clubs)
                           .Four(Suit.Clubs)
                           .Five(Suit.Clubs)
                           .Nine(Suit.Spades)
                           .Ten(Suit.Spades));
            var hand2 = new StraightFlush();

            hand2.SetCards(Cards.New()
                           .Two(Suit.Clubs)
                           .Three(Suit.Clubs)
                           .Four(Suit.Clubs)
                           .Five(Suit.Clubs)
                           .Six(Suit.Clubs)
                           .Nine(Suit.Spades)
                           .Jack(Suit.Spades));
            Assert.IsTrue(hand1.IsPresent());
            Assert.IsTrue(hand2.IsPresent());
            Assert.Less(hand1, hand2);
        }
        public void straightflush_no()
        {
            var set   = new StraightFlush();
            var cards = new List <Card>
            {
                new Card(Suit.Clubs, Rank.Ace),
                new Card(Suit.Diamonds, Rank.Ace),
                new Card(Suit.Spades, Rank.Ace),
                new Card(Suit.Hearts, Rank.King),
                new Card(Suit.Spades, Rank.Ten),
                new Card(Suit.Spades, Rank.King)
            };

            set.SetCards(cards);
            var result = set.IsPresent();

            Assert.IsFalse(result);
        }
        public void straightflush_yes()
        {
            var set   = new StraightFlush();
            var cards = new List <Card>
            {
                new Card(Suit.Spades, Rank.King),
                new Card(Suit.Spades, Rank.Jack),
                new Card(Suit.Spades, Rank.Queen),
                new Card(Suit.Spades, Rank.Nine),
                new Card(Suit.Spades, Rank.Ten),
                new Card(Suit.Diamonds, Rank.Six),
                new Card(Suit.Spades, Rank.Two)
            };

            set.SetCards(cards);
            var result = set.IsPresent();

            Assert.IsTrue(result);
        }