Пример #1
0
        public void CreateFlush()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Flush";
            var    testPokHand  = CreateTestPokerHand("Tony G", "AH", "4H", "8H", "3H", "2H");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PokerHandsService"/> class.
 /// </summary>
 /// <param name="pokerHandsRepository">The poker hands repository.</param>
 /// <param name="mapper">The mapper.</param>
 /// <exception cref="ArgumentNullException">pokerHandsRepository</exception>
 /// <exception cref="ArgumentNullException">mapper</exception>
 public PokerHandsService(IPokerHandsRepository pokerHandsRepository,
                          IMapper mapper)
 {
     _pokerHandsRepository = pokerHandsRepository ??
                             throw new ArgumentNullException(nameof(pokerHandsRepository));
     _mapper = mapper ??
               throw new ArgumentNullException(nameof(mapper));
     _handTypeCalculator = new HandTypeCalculator();
     _handComparer       = new HandComparer();
 }
Пример #3
0
        public void CreateFullHouse()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Full House";
            var    testPokHand  = CreateTestPokerHand("Phil Hellmuth", "AH", "AS", "AD", "6C", "6H");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #4
0
        public void CreateFullHouse2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Full House";
            var    testPokHand  = CreateTestPokerHand("Tony G", "4H", "2S", "4D", "4C", "2H");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #5
0
        public void CreateStraightFlush2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Straight Flush";
            var    testPokHand  = CreateTestPokerHand("Phil Hellmuth1", "2H", "6H", "3H", "4H", "5H");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #6
0
        public void CreateFourOfAKind2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Four of a Kind";
            var    testPokHand  = CreateTestPokerHand("Phil Hellmuth", "4H", "4S", "AD", "4C", "4D");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #7
0
        public void CreateHighCard()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "High Card";
            var    testPokHand  = CreateTestPokerHand("Toby Maguire", "AS", "KH", "6C", "3H", "JC");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #8
0
        public void CreateHighCard2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "High Card";
            var    testPokHand  = CreateTestPokerHand("Daniel Negreanu", "2D", "7H", "6S", "10D", "4C");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #9
0
        public void CreateTwoPair2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Two Pair";
            var    testPokHand  = CreateTestPokerHand("Daniel Negreanu", "2D", "2H", "6S", "6D", "3D");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #10
0
        public void CreateTrips2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Three of a Kind";
            var    testPokHand  = CreateTestPokerHand("Toby Maguire", "2D", "6H", "6S", "6D", "3D");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #11
0
        public void CreateStraight2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Straight";
            var    testPokHand  = CreateTestPokerHand("Toby Maguire", "2H", "6D", "3S", "4H", "5C");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Пример #12
0
        public void ThenCorrectHandTypeReturned(string[] input, HandType expectedHandType)
        {
            var cards = new List <Card>();

            for (int i = 0; i < input.Length; i++)
            {
                string cardValue = input[i];
                var    card      = CardFactory.CreateCard(cardValue);
                cards.Add(card);
            }
            var handType = HandTypeCalculator.GetHandTypeFromCards(cards);

            Assert.AreEqual(expectedHandType, handType);
        }
Пример #13
0
        public void NotAllowNullPokerHand()
        {
            HandTypeCalculator sut = new HandTypeCalculator();

            Assert.Throws <ArgumentNullException>("hand", () => sut.GetHandType(null));
        }
Пример #14
0
        public void CreateHandTypeCalculator()
        {
            HandTypeCalculator sut = new HandTypeCalculator();

            Assert.IsType <HandTypeCalculator>(sut);
        }