Esempio n. 1
0
        public void AddRound_FirstRound_IncreasesCountToOne()
        {
            var aquiredPokerRound = new AquiredPokerRound();

            _aquiredPlayer.AddRound(aquiredPokerRound);

            Assert.That(_aquiredPlayer.Count, Is.EqualTo(1));
        }
Esempio n. 2
0
        public void AddRound_FirstRound_AddsTheRound()
        {
            var aquiredPokerRound = new AquiredPokerRound();

            _aquiredPlayer.AddRound(aquiredPokerRound);

            Assert.That(_aquiredPlayer[0], Is.EqualTo(aquiredPokerRound));
        }
        static IAquiredPokerPlayer CreateNonPostingActivePlayer(string someName, ActionTypes action, double ratio)
        {
            IAquiredPokerPlayer aquiredPlayer = CreateAquiredPlayer(someName);
            var round = new AquiredPokerRound();

            round.Add(new AquiredPokerAction(action, ratio));
            aquiredPlayer.AddRound(round);

            return(aquiredPlayer);
        }
        static IAquiredPokerPlayer CreatePostingPlayer(string someName, double postedAmount)
        {
            IAquiredPokerPlayer aquiredPlayer = CreateAquiredPlayer(someName);
            var round = new AquiredPokerRound();

            round.Add(new AquiredPokerAction(ActionTypes.P, postedAmount));
            aquiredPlayer.AddRound(round);

            return(aquiredPlayer);
        }
Esempio n. 5
0
        ProcessRound_PreflopAquPlayerWithOneRoundConPlayerWithNoRound_AddsPreflopRoundAndActionToConvertedPokerPlayer
            ()
        {
            IAquiredPokerRound aquiredRound =
                new AquiredPokerRound()
                .Add(new AquiredPokerAction(_stub.Valid(For.ActionType, ActionTypes.C), _stub.Some <double>()));
            IConvertedPokerPlayer convertedPlayer = new ConvertedPokerPlayer();

            _converter.InvokeProcessRound(Streets.PreFlop, aquiredRound, convertedPlayer);

            IConvertedPokerAction firstPreflopAction = convertedPlayer[Streets.PreFlop][0];

            Assert.That(firstPreflopAction, Is.EqualTo(aquiredRound[0]));
        }
Esempio n. 6
0
        public void ProcessRound_PokerPlayerWithNoRound_DoesNotReThrowNullReferenceException(
            [Values(Streets.PreFlop, Streets.Flop, Streets.Turn, Streets.River)] Streets street)
        {
            var convertedPlayer = new ConvertedPokerPlayer();

            IAquiredPokerRound aquiredRound =
                new AquiredPokerRound()
                .Add(new AquiredPokerAction(_stub.Valid(For.ActionType, ActionTypes.C), _stub.Some <double>()));

            // Logs the exception and goes on
            TestDelegate invokeProcessRound = () =>
                                              NotLogged(() => _converter.InvokeProcessRound(street, aquiredRound, convertedPlayer));

            Assert.DoesNotThrow(invokeProcessRound);
        }
Esempio n. 7
0
        public void ProcessRound_InvalidActionType_SetsFoundActionToTrue(
            [Values(Streets.PreFlop, Streets.Flop, Streets.Turn, Streets.River)] Streets street)
        {
            IAquiredPokerRound aquiredPokerRoundStub = new AquiredPokerRound()
                                                       .Add(new AquiredPokerAction(ActionTypes.E, _stub.Some <double>()));

            // This will log an error (illegal action) after found action was set to true and not rethrow
            NotLogged(
                () => _converter.InvokeProcessRound(
                    street,
                    aquiredPokerRoundStub,
                    _stub.Out <IConvertedPokerPlayer>()));

            Assert.That(_converter.FoundActionProp, Is.True);
        }
Esempio n. 8
0
        ProcessRound_PreflopAquPlayerWithOneRoundConPlayerWithOneRound_AddsPreflopActionToConvertedPokerPlayerFirstRound
            ()
        {
            const ActionTypes  someActionType = ActionTypes.C;
            const double       someRatio      = 1.0;
            IAquiredPokerRound aquiredRound   = new AquiredPokerRound()
                                                .Add(new AquiredPokerAction(someActionType, someRatio));

            IConvertedPokerPlayer convertedPlayer = new ConvertedPokerPlayer().Add();

            _converter.InvokeProcessRound(Streets.PreFlop, aquiredRound, convertedPlayer);

            IConvertedPokerAction firstPreflopAction = convertedPlayer[Streets.PreFlop][0];

            const int first = 0;

            Assert.That(firstPreflopAction, Is.EqualTo(aquiredRound[first]));
        }
Esempio n. 9
0
        public void ProcessRound_PreflopAquPlayerWithOneRound_AddsActionAndPlayerIdToSequencesForCurrentRound()
        {
            const int             playerPosition = 1;
            IConvertedPokerPlayer playerStub     = new ConvertedPokerPlayer()
                                                   .Add();

            playerStub.Position = playerPosition;

            IAquiredPokerRound aquiredRound =
                new AquiredPokerRound()
                .Add(new AquiredPokerAction(_stub.Valid(For.ActionType, ActionTypes.C), _stub.Some <double>()));

            var expectedAction =
                new ConvertedPokerActionWithId(new ConvertedPokerAction(ActionTypes.C, 0), playerPosition);

            _converter.InvokeProcessRound(Streets.PreFlop, aquiredRound, playerStub);

            Assert.That(_converter.SequenceForCurrentRoundProp[0], Is.EqualTo(expectedAction));
        }
Esempio n. 10
0
        public void ProcessRound_Preflop_SetsActionSequenceOnConvertedPlayer()
        {
            IAquiredPokerRound aquiredRound = new AquiredPokerRound()
                                              .Add(
                new AquiredPokerAction(_stub.Valid(For.ActionType, ActionTypes.C), _stub.Out <double>(For.Ratio)));

            const Streets street = Streets.PreFlop;

            var convertedPlayerMock = new Mock <IConvertedPokerPlayer>();

            convertedPlayerMock
            .SetupGet(p => p[street])
            .Returns(_stub.Out <IConvertedPokerRound>());

            _converter.InvokeProcessRound(street, aquiredRound, convertedPlayerMock.Object);
            string sequenceSoFar = _converter.SequenceSoFarProp;

            convertedPlayerMock.Verify(
                player => player.SetActionSequenceString(ref sequenceSoFar, It.IsAny <IConvertedPokerAction>(), street));
        }
Esempio n. 11
0
        ProcessRound_PreflopAquPlayerWithTwoRoundsConPlayerWithOneRoundActionCountOne_AddsSecondPreflopActionAsFirstActionOfConvertedPokerPlayersFirstRound
            ()
        {
            const ActionTypes  firstActionType  = ActionTypes.C;
            const ActionTypes  secondActionType = ActionTypes.F;
            const double       someRatio        = 1.0;
            IAquiredPokerRound aquiredRound     = new AquiredPokerRound()
                                                  .Add(new AquiredPokerAction(firstActionType, someRatio))
                                                  .Add(new AquiredPokerAction(secondActionType, someRatio));

            IConvertedPokerPlayer convertedPlayer = new ConvertedPokerPlayer().Add();

            _converter.ActionCountProp = 1;
            _converter.InvokeProcessRound(Streets.PreFlop, aquiredRound, convertedPlayer);

            IConvertedPokerAction addedPreflopAction = convertedPlayer[Streets.PreFlop][0];

            const int second = 1;

            Assert.That(addedPreflopAction, Is.EqualTo(aquiredRound[second]));
        }
 public void _Init()
 {
     _aquiredRound = new AquiredPokerRound();
 }