예제 #1
0
        public void OnePairShouldWinAgainstHighCard()
        {
            var hand1 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(6, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });
            var hand2 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(1, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });

            var handList = new List <IHand>()
            {
                hand1, hand2
            };
            var handEvaluator = new HandEvaluator();

            handEvaluator.Evaluate(handList);

            var winnerSelector = new WinnerSelector();

            winnerSelector.SelectWinner(handList);

            Assert.IsTrue(hand2.IsWinner);
        }
예제 #2
0
        public Selector(ILogger <Selector> logger, IDbContextFactory <AppDbContext> contextFactory, WinnerSelector winnerSelector, WinnerReader winnerReader, PipeClient pipeClient)
        {
            _logger         = logger;
            _contextFactory = contextFactory;

            _winnerSelector = winnerSelector;
            _winnerReader   = winnerReader;
            _pipe_client    = pipeClient;
        }
예제 #3
0
        public Analyst(ILogger <Analyst> logger,
                       IDbContextFactory <AppDbContext> contextFactory,
                       WinnerAnalysis winnerAnalysis, WinnerPercent winnerPercent,
                       WinnerScoring winnerScoring, WinnerSelector winnerSelector, WinnerReader winnerReader, PipeClient pipeClient)
        {
            _logger         = logger;
            _contextFactory = contextFactory;

            _winnerAnalysis = winnerAnalysis;
            _winnerPercent  = winnerPercent;
            _winnerScoring  = winnerScoring;
            _winnerSelector = winnerSelector;
            _winnerReader   = winnerReader;

            _pipe_client = pipeClient;
        }
예제 #4
0
        public void HighCardHandWithLargerHighCardShouldWin()
        {
            var hand1 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(11, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });
            var hand2 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(2, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });

            var hand3 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(12, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });

            var handList = new List <IHand>()
            {
                hand1, hand2, hand3
            };

            var handEvaluator = new HandEvaluator();

            handEvaluator.Evaluate(handList);

            var winnerSelector = new WinnerSelector();

            winnerSelector.SelectWinner(handList);

            Assert.IsTrue(hand3.IsWinner);
        }
예제 #5
0
        public Choicer(ILogger <Choicer> logger,
                       IDbContextFactory <AppDbContext> contextFactory,
                       WinnerMember winnerMember, WinnerScoring winnerScoring, WinnerSelector winnerSelector,
                       PrintOutLottoLion printOut, MailSenderLottoLion mailSender, NotifyPushLottoLion notifyPush
                       )
        {
            _logger         = logger;
            _contextFactory = contextFactory;

            _winnerMember   = winnerMember;
            _winnerScoring  = winnerScoring;
            _winnerSelector = winnerSelector;

            _printOut   = printOut;
            _mailSender = mailSender;
            _notifyPush = notifyPush;

            _choiceSeqno = new ConcurrentDictionary <string, int>();
        }
예제 #6
0
        public void OnePairShouldWinInASinglePlayerGame()
        {
            var hand1 = new PokerHand(new List <ICard>()
            {
                new PlayingCard(1, "Club"),
                new PlayingCard(1, "Heart"),
                new PlayingCard(5, "Club"),
                new PlayingCard(7, "Club"),
                new PlayingCard(9, "Club"),
            });

            var handList = new List <IHand>()
            {
                hand1
            };
            var winnerSelector = new WinnerSelector();

            winnerSelector.SelectWinner(handList);

            Assert.IsTrue(hand1.IsWinner);
        }
예제 #7
0
        public void NoWinnerIfNoSteps()
        {
            var winnerSelector = new WinnerSelector(FieldSize);

            Assert.Equal(null, winnerSelector.GetWinner(new List <Step>()));
        }