コード例 #1
0
        public void ShouldRejectIfNotFourOfAKind()
        {
            IEnumerable<Card> result = new FourOfAKind().Match(new[] {
                                                                        2.Of(Suit.Hearts),
                                                                        2.Of(Suit.Spades),
                                                                        5.Of(Suit.Clubs),
                                                                        6.Of(Suit.Diamonds),
                                                                        8.Of(Suit.Clubs),
                                                                        9.Of(Suit.Hearts),
                                                                        10.Of(Suit.Hearts)
                                                                    });

            Assert.That(result, Is.Null, "Should not have matched anything.");
        }
コード例 #2
0
        public void ShouldDetectFourOfAKind()
        {
            IEnumerable<Card> result = new FourOfAKind().Match(new[] {
                                                                    2.Of(Suit.Hearts),
                                                                    2.Of(Suit.Spades),
                                                                    2.Of(Suit.Clubs),
                                                                    2.Of(Suit.Diamonds),
                                                                    8.Of(Suit.Clubs),
                                                                    9.Of(Suit.Hearts),
                                                                    10.Of(Suit.Hearts)
                                                                });

            Assert.That(result.Count(), Is.EqualTo(4),
                        "Should only have 4 cards in the winning cards collection.");

            Assert.That(result.All( x => x.Rank == 2), Is.True, "Should have matched the 2's");
        }