public TraditionalBowlingScoreCalculatorValidator(TraditionalBowlingScoringCalculator traditionalBowlingScoreCalculator) { #region Guard clause if (traditionalBowlingScoreCalculator == null) { throw new ArgumentException("traditionalBowlingScoreCalculator can't be null."); } #endregion Guard clause _scoreCalculator = traditionalBowlingScoreCalculator; }
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); }