public void CalculateTotalScore_ShouldCalculateScoreCorrectly( string lineStringSpecification, int expectedScore) { var parser = new BowlingLineParser(); var line = parser.ParseLine(lineStringSpecification); line .CalculateTotalScore() .Should() .Be(expectedScore, $"because total score of line {lineStringSpecification} should be {expectedScore}"); }
private static void Main( string[] args) { try { string input = Console.ReadLine(); var parser = new BowlingLineParser(); var line = parser.ParseLine(input); var totalScore = line.CalculateTotalScore(); Console.WriteLine(totalScore); } catch (ParseException e) { Console.Error.WriteLine($"Invalid input: {e.Message}"); } catch (Exception e) { Console.Error.WriteLine($"Unknown error: {e.Message}"); } }