Ejemplo n.º 1
0
        public void BowlingScoreCalculator_CalculatesProperly(string scoreCardString, int actualScore)
        {
            bool success = ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out ScoreCard <TenPinBowlingType> scoreCard);

            int calculatedScore = BowlingScoreCalculator <TenPinBowlingType> .CalculateScore(scoreCard);

            Assert.AreEqual(actualScore, calculatedScore);
        }
Ejemplo n.º 2
0
        public int CalculateScore(string game)
        {
            bool scoreCardParseSuccess = ScoreCardParser.TryParse <TenPinBowlingType>(game, out var scoreCard);

            return(BowlingScoreCalculator <TenPinBowlingType> .CalculateScore(scoreCard));
        }
Ejemplo n.º 3
0
 public void BowlingScoreCardParser_CreationSucceeds(string scoreCardString)
 {
     Assert.IsTrue(ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out var scoreCard));
 }
Ejemplo n.º 4
0
 public void BowlingScoreCardParser_CreationFails(string scoreCardString)
 {
     Assert.IsFalse(ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out var scoreCard));
 }
Ejemplo n.º 5
0
        public void BowlingScoreCardGenerator_CreatesProperNumberOfFrames(string scoreCardString, int numFrames)
        {
            var success = ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out ScoreCard <TenPinBowlingType> scoreCard);

            Assert.AreEqual(scoreCard.Frames.Count, numFrames);
        }
 public ScoreCalculator()
 {
     _specialScoreModifier = new SpecialScoreModifier(NumberOfRounds);
     _scoreCardParser      = new ScoreCardParser();
     _gameGenerator        = new FrameScoreGenerator();
 }
 public void BeforeEachTest()
 {
     _scoreCardParser = new ScoreCardParser();
 }