Esempio n. 1
0
        public void _PreflopVaryPlayerSequenceFoldCheckCall_CurrentSequenceIsNotChanged(
            [Values(ActionTypes.F, ActionTypes.X, ActionTypes.C)] ActionTypes actionType,
            [Values("", "nonEmpty")] string playerSequence)
        {
            const Streets street          = Streets.PreFlop;
            const double  ratio           = 1.0;
            var           convertedAction = new ConvertedPokerAction(actionType, ratio);

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = string.Empty;
            string expectedSequence = String.Copy(currentSequence);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(currentSequence, Is.EqualTo(expectedSequence));
        }
Esempio n. 2
0
        public void _PostFlopVaryPlayerSequenceRaise_IsAppendedToCurrentSequence(
            [Values(Streets.Flop, Streets.Turn, Streets.River)] Streets street,
            [Values("", "nonEmpty")] string playerSequence)
        {
            const ActionTypes actionType = ActionTypes.R;
            const double      ratio      = 1.0;
            var convertedAction          = new ConvertedPokerAction(actionType, ratio);

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = string.Empty;
            string expectedSequence = String.Concat(currentSequence, actionType);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(currentSequence, Is.EqualTo(expectedSequence));
        }
Esempio n. 3
0
        _PostFlopPlayerSequenceDoesNotContainNumberCheckFoldCallRaise_CurrentSequenceAndActionIsAppendedToPlayerSequence(
            [Values(Streets.Flop, Streets.Turn, Streets.River)] Streets street,
            [Values(ActionTypes.F, ActionTypes.X, ActionTypes.C, ActionTypes.R)] ActionTypes actionType,
            [Values("", "nonEmpty")] string playerSequence)
        {
            const double ratio           = 0.54;
            var          convertedAction = new ConvertedPokerAction(actionType, ratio);
            string       currentSequence = "someSequence";

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string expectedSequence = String.Concat(playerSequence, currentSequence, actionType);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(_convertedPlayer.SequenceStrings[(int)street], Is.EqualTo(expectedSequence));
        }
Esempio n. 4
0
        _PostFlopPlayerSequenceDoesNotContainNumberBet_CurrentSequenceAndNormalizedRatioIsAppendedToPlayerSequence(
            [Values(Streets.Flop, Streets.Turn, Streets.River)] Streets street,
            [Values("", "nonEmpty")] string playerSequence)
        {
            const ActionTypes actionType      = ActionTypes.B;
            const double      ratio           = 0.54;
            const string      normalizedRatio = "5";
            var convertedAction = new ConvertedPokerAction(actionType, ratio);

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = "someSequence";
            string expectedSequence = String.Concat(playerSequence, currentSequence, normalizedRatio);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(_convertedPlayer.SequenceStrings[(int)street], Is.EqualTo(expectedSequence));
        }
Esempio n. 5
0
        public void _PostFlopPlayerSequenceContainsNumberVaryActionType_PlayerSequenceIsNotChanged(
            [Values(Streets.Flop, Streets.Turn, Streets.River)] Streets street,
            [Values(ActionTypes.F, ActionTypes.X, ActionTypes.C, ActionTypes.B, ActionTypes.R)] ActionTypes actionType)
        {
            const double someRatio       = 1.0;
            var          convertedAction = new ConvertedPokerAction(actionType, someRatio);

            const string playerSequence = "5";

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = string.Empty;
            string expectedSequence = String.Copy(playerSequence);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(_convertedPlayer.SequenceStrings[(int)street], Is.EqualTo(expectedSequence));
        }
Esempio n. 6
0
        public void _PreflopNonEmptyPlayerSequenceVaryActionType_PlayerSequenceIsNotChanged(
            [Values(ActionTypes.F, ActionTypes.X, ActionTypes.C, ActionTypes.B, ActionTypes.R)] ActionTypes actionType)
        {
            const Streets street          = Streets.PreFlop;
            const double  someRatio       = 1.0;
            var           convertedAction = new ConvertedPokerAction(actionType, someRatio);

            const string playerSequence = "nonEmpty";

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = string.Empty;
            string expectedSequence = String.Copy(playerSequence);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(_convertedPlayer.SequenceStrings[(int)street], Is.EqualTo(expectedSequence));
        }
Esempio n. 7
0
        public void _PreflopNonEmptyPlayerSequenceRaise_CurrentSequenceIsNotChanged()
        {
            const Streets     street     = Streets.PreFlop;
            const ActionTypes actionType = ActionTypes.R;
            const double      ratio      = 2.1;
            var convertedAction          = new ConvertedPokerAction(actionType, ratio);

            const string playerSequence = "nonEmpty";

            _convertedPlayer.SequenceStrings[(int)street] = playerSequence;
            string currentSequence  = string.Empty;
            string expectedSequence = String.Copy(currentSequence);

            _convertedPlayer.SetActionSequenceString(ref currentSequence, convertedAction, street);

            Assert.That(currentSequence, Is.EqualTo(expectedSequence));
        }
        public void Get_HandWithSequencesWasSaved_RestoresSequences()
        {
            var sampleAction = new ConvertedPokerAction(ActionTypes.C, 1.0);

            _hand.Sequences[(int)Streets.PreFlop] =
                new ConvertedPokerRound().Add(new ConvertedPokerActionWithId(sampleAction, 0));
            _hand.Sequences[(int)Streets.Flop] =
                new ConvertedPokerRound().Add(new ConvertedPokerActionWithId(sampleAction, 1));
            _hand.Sequences[(int)Streets.Turn] =
                new ConvertedPokerRound().Add(new ConvertedPokerActionWithId(sampleAction, 2));
            _hand.Sequences[(int)Streets.River] =
                new ConvertedPokerRound().Add(new ConvertedPokerActionWithId(sampleAction, 3));

            _session.Save(_hand);
            FlushAndClearSession();

            IConvertedPokerHand retrievedHand = _sut.Get(_hand.Id);

            retrievedHand.Sequences.ShouldBeEqualTo(_hand.Sequences);
        }
Esempio n. 9
0
        public void XmlDeserialize_SerializedLegalAction_ReturnsSerializedAction()
        {
            var legalAction = new ConvertedPokerAction(ActionTypes.B, 2.0);

            Assert.That(legalAction.XmlDeserializedInMemory(), Is.EqualTo(legalAction));
        }
Esempio n. 10
0
        public void BinaryDeserialize_SerializedIllegalAction_ReturnsSerializedAction()
        {
            var illegalAction = new ConvertedPokerAction(ActionTypes.E, 1.0);

            Assert.That(illegalAction.BinaryDeserializedInMemory(), Is.EqualTo(illegalAction));
        }