public void A_Bowling_Game_Should_Have_Bonus_Balls_Indicator() { const string bowlingGameStats = "X|X|X|X|X|X|X|X|X|X"; var sut = new GameParser(new ScoreBoardValidator()); Action act = () => { sut.GenerateScoreBoard(bowlingGameStats); }; act.Should().Throw <InvalidGameInputException>() .WithMessage($"Invalid game input {bowlingGameStats}"); }
public void A_FRAME_In_A_Bowling_Game_Should_Not_Have_More_Than_Two_Input() { const string bowlingGameStats = "X|X|X|X|X|X|234|X|X|X||XX"; var sut = new GameParser(new ScoreBoardValidator()); Action act = () => { sut.GenerateScoreBoard(bowlingGameStats); }; act.Should().Throw <InvalidGameInputException>() .WithMessage($"Invalid game input {bowlingGameStats}"); }
public void Should_Not_Have_Sum_Of_Two_Bonus_Balls_Greater_Than_Ten() { const string bowlingGameStats = "X|X|X|X|X|X|X|X|X|5/||88"; var sut = new GameParser(new ScoreBoardValidator()); Action act = () => { sut.GenerateScoreBoard(bowlingGameStats); }; act.Should().Throw <InvalidGameInputException>() .WithMessage($"Invalid game input {bowlingGameStats}"); }
public void Should_Not_Have_No_Bonus_Balls_When_Frame_Ten_Is_Spare() { const string bowlingGameStats = "X|X|X|X|X|X|X|X|X|5/||"; var sut = new GameParser(new ScoreBoardValidator()); Action act = () => { sut.GenerateScoreBoard(bowlingGameStats); }; act.Should().Throw <InvalidGameInputException>() .WithMessage($"Invalid game input {bowlingGameStats}"); }
public void A_FRAME_In_A_Bowling_Game_Should_Not_Have_Strike_As_First_Input_Follow_By_Zero_Pins() { const string bowlingGameStats = "X|X|X|X|X|X|X-|X|X|X||XX"; var sut = new GameParser(new ScoreBoardValidator()); Action act = () => { sut.GenerateScoreBoard(bowlingGameStats); }; act.Should().Throw <InvalidGameInputException>() .WithMessage($"Invalid game input {bowlingGameStats}"); }
public void Should_Generate_ScoreBoard_With_All_Strike_Frames() { const string bowlingGameStats = "x|x|X|X|x|x|x|x|x|x||xx"; const int minNumberOfThrowPerFrame = 1; var sut = new GameParser(new ScoreBoardValidator()); var result = sut.GenerateScoreBoard(bowlingGameStats); result.Length.Should().Be(InputIndex.NumberOfFramesInBowlingGame); foreach (var frame in result) { frame.NumberOfBonusAcquired.Should().Be(FrameBonus.Strike); frame.PinsDroppedOfAThrow.Count().Should().Be(minNumberOfThrowPerFrame); frame.PinsDroppedOfABonusBall.Count().Should().Be((int)FrameBonus.Strike); } }
public ScoreBoard(string gameInfo, GameParser gameParser) { _frames = gameParser.GenerateScoreBoard(gameInfo); }