Ejemplo n.º 1
0
        public void FourOfAKindUnitTests_1()
        {
            var fourOfAKindHands = new Dictionary <long, string>()
            {
                { 0x0008004002001000, string.Empty },                                        // 0000 0000 0000/1000 0000.0000 0/100.0000 0000.00/10 0000.0000 000/1.0000 0000.0000
                { 0x0008004002001007, string.Empty }                                         // 0000 0000 0000/1000 0000.0000 0/100.0000 0000.00/10 0000.0000 000/1.0000 0000.0111
            };

            var pht = new FourOfAKind();

            foreach (var hand in fourOfAKindHands)
            {
                var ph = new PokerHand(hand.Key);
                Assert.True(pht.Parse(ph), hand.Value);
                Assert.Equal(PokerHandAnalyzer.Strength.FourOfAKind, ph.Strength);
            }
        }
Ejemplo n.º 2
0
        public void StraightFlush_Is_Better_Than_FourOfAKind()
        {
            const long straightFlushHand = 0x000000000040201F;   // 00000000 0000//0000 0000.0000 0/000.0000 0000.00/00 0100.0000 001/0.0000 0001.1111
            const long fourOfAKindHand   = 0x0008004002001000;   // 0000 0000 0000/1000 0000.0000 0/100.0000 0000.00/10 0000.0000 000/1.0000 0000.0000

            var pht1 = new StraightFlush();
            var pht2 = new FourOfAKind();

            var ph1 = new PokerHand(straightFlushHand);

            pht1.Parse(ph1);
            var ph2 = new PokerHand(fourOfAKindHand);

            pht2.Parse(ph2);

            Assert.Equal(-1, ph1.CompareTo(ph2));
            Assert.Equal(1, ph2.CompareTo(ph1));
            ph2 = new PokerHand(straightFlushHand);
            pht1.Parse(ph2);
            Assert.Equal(0, ph1.CompareTo(ph2));
        }