Esempio n. 1
0
        public LastScoreFrame(IScoreFrame previousScoreFrame, int firstPinScore) : base(previousScoreFrame)
        {
            if (!ScoreHelper.IsValidPinScore(firstPinScore))
            {
                throw new ArgumentOutOfRangeException(nameof(firstPinScore));
            }

            pinScores = new List <int>(3)
            {
                firstPinScore
            };
        }
Esempio n. 2
0
        public void Process(int pinScore)
        {
            if (remainBonusCount <= 0)
            {
                throw new InvalidOperationException();
            }

            if (!ScoreHelper.IsValidPinScore(pinScore))
            {
                throw new ArgumentOutOfRangeException(nameof(pinScore));
            }

            bonusScore += pinScore;
            remainBonusCount--;
            if (remainBonusCount <= 0)
            {
                frameScoreConfirmable.ConfirmFrameScore(bonusScore);
            }
        }
Esempio n. 3
0
        public override ScoreFrameState AddPinScore(int pinScore)
        {
            if (pinScores.Count != 1)
            {
                throw new InvalidOperationException();
            }

            if (!ScoreHelper.IsValidPinScore(pinScore, pinScores[0]))
            {
                throw new ArgumentOutOfRangeException(nameof(pinScore));
            }
            pinScores.Add(pinScore);
            SetComplete();
            if (TotalPinScore == ScoreRules.MaxPinScore)
            {
                return(ScoreFrameState.Spare);
            }
            ConfirmFrameScore(0);
            return(ScoreFrameState.Open);
        }