예제 #1
0
        public TraditionalBowlingScoreCalculatorValidator(TraditionalBowlingScoringCalculator traditionalBowlingScoreCalculator)
        {
            #region Guard clause

            if (traditionalBowlingScoreCalculator == null)
            {
                throw new ArgumentException("traditionalBowlingScoreCalculator can't be null.");
            }

            #endregion Guard clause

            _scoreCalculator = traditionalBowlingScoreCalculator;
        }
예제 #2
0
        internal CalculatedBowlingScoresDto ConstructScoresToValidate(IList <BowlingFrame> playedBowlingFrames, TraditionalBowlingScoringCalculator scoreCalculator)
        {
            CalculatedBowlingScoresDto validationObject = new CalculatedBowlingScoresDto()
            {
                token  = _apiValidationToken,
                points = new int[playedBowlingFrames.Count]
            };

            int summarizedGameScore = 0;

            for (int i = 0; i < playedBowlingFrames.Count; i++)
            {
                summarizedGameScore       += _scoreCalculator.CalculateScoreForSingleFrame(i + 1, playedBowlingFrames);
                validationObject.points[i] = summarizedGameScore;
            }

            return(validationObject);
        }