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); }
public int CalculateScore(string game) { bool scoreCardParseSuccess = ScoreCardParser.TryParse <TenPinBowlingType>(game, out var scoreCard); return(BowlingScoreCalculator <TenPinBowlingType> .CalculateScore(scoreCard)); }
public void BowlingScoreCardParser_CreationSucceeds(string scoreCardString) { Assert.IsTrue(ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out var scoreCard)); }
public void BowlingScoreCardParser_CreationFails(string scoreCardString) { Assert.IsFalse(ScoreCardParser.TryParse <TenPinBowlingType>(scoreCardString, out var scoreCard)); }
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(); }