Esempio n. 1
0
        public void CreateStraightFlush()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Straight Flush";
            var    testPokHand  = CreateTestPokerHand("Phil Hellmuth1", "AH", "KH", "10H", "JH", "QH");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public void CreateFlush2()
        {
            var    testHandCalc = new HandTypeCalculator();
            string expectedType = "Flush";
            var    testPokHand  = CreateTestPokerHand("Tony G", "AC", "4C", "10C", "QC", "2C");

            var pokerHandReturned = testHandCalc.GetHandType(testPokHand);

            Assert.Equal(expectedType, pokerHandReturned.Name);
        }
Esempio n. 8
0
        /// <summary>
        /// Saves the poker hand to the db.
        /// </summary>
        /// <param name="pokerHandDto">The poker hand dto that will be saved.</param>
        /// <returns>The poker hand dto that was saved.</returns>
        public PokerHandDto AddPokerHand(PokerHandForCreationDto pokerHandDto)
        {
            var pokerHandToAdd = _mapper.Map <PokerHand>(pokerHandDto);

            //Add call to determine card type
            pokerHandToAdd.Type = _handTypeCalculator.GetHandType(pokerHandToAdd).Name;
            _pokerHandsRepository.AddPokerHand(pokerHandToAdd);
            var pokerDtoToReturn = _mapper.Map <PokerHandDto>(pokerHandToAdd);

            return(pokerDtoToReturn);
        }
Esempio n. 9
0
        public void NotAllowNullPokerHand()
        {
            HandTypeCalculator sut = new HandTypeCalculator();

            Assert.Throws <ArgumentNullException>("hand", () => sut.GetHandType(null));
        }