public void FourEightsAndNine()
            {
                // ARRANGE
                var fourAces = FourAcesAndANine().Cards.Where(
                    c =>
                    Rank.ACE == c.Rank);

                var fourEights = fourAces.Select(
                    c =>
                    new Card(Rank.EIGHT, c.Suit)).ToArray();

                var game = new Game(
                    fourEights[0],
                    fourEights[1],
                    fourEights[2],
                    fourEights[3],
                    CardBuilder.Nine().Spades());

                // ACT
                var result = new FourOfAKind().Evaluate(game);

                // ASSERT
                Assert.IsTrue(result.Success());
                CollectionAssert.AreEquivalent(fourEights.ToList(), result.UsedCards.ToList());
            }
 private Game FourAcesAndANine()
 {
     return(new Game(
                CardBuilder.Ace().Hearths(),
                CardBuilder.Ace().Diamonds(),
                CardBuilder.Ace().Clubs(),
                CardBuilder.Ace().Spades(),
                CardBuilder.Nine().Hearths()));
 }
Example #3
0
            public void NineInsteadOfTen()
            {
                var royalFlush = Helper.HearthsRoyalFlush();

                var game = GameBuilder.Game(royalFlush).SwapLastCardWith(
                    CardBuilder.Nine().Hearths());

                // ACT
                var result = new RoyalFlush().Evaluate(game);

                // ASSERT
                Assert.IsFalse(result.Success());
            }
Example #4
0
        public void StraightFlush()
        {
            // ARRANGE
            var game = new Game(
                CardBuilder.Eight().Hearths(),
                CardBuilder.Seven().Hearths(),
                CardBuilder.Nine().Hearths(),
                CardBuilder.Ten().Hearths(),
                CardBuilder.Jack().Hearths());

            // ACT
            new GameEvaluator().Evaluate(game);

            // ASSERT
            Assert.AreEqual(GameCategory.STRAIGHT_FLUSH, game.Category);
        }