public void CanRecognizeValidBowlingLineString() { foreach (var g in games) { var b = new BowlingLine(g); Assert.AreEqual(10, b.Frames.Count); } }
public void Should_ThrowIfThereAreNoPlayers() { //arrange InstantiateUnderTest(); var bowlingLine = new BowlingLine(new List<BowlingLineScore>()); //act _underTest.CalculateScores(bowlingLine); }
public void Should_ThrowIfTooManyFramesRecorded(string score) { //arrange InstantiateUnderTest(); var playerScore = new BowlingLineScore("test", score); //pass 12 frame scores _scoreParser.Setup(p => p.ParseScores(It.IsAny<string>())) .Returns(TestHelper.GetNumberOfParsedScores(12)); _bowlingFrameBuilder .Setup(b => b.BuildScores(It.IsAny<IEnumerable<Tuple<int, int>>>())) .Returns(TestHelper.GetNumberOfFrames(12)); var bowlingLine = new BowlingLine(new List<BowlingLineScore>{playerScore}); //act _underTest.CalculateScores(bowlingLine); }
public void Should_ParseScores() { //arrange InstantiateUnderTest(); var playerScore = new BowlingLineScore("test", TestHelper.AllStrikes); _scoreParser.Setup(p => p.ParseScores(It.IsAny<string>())) .Returns(TestHelper.GetNumberOfParsedScores(10)); _bowlingFrameBuilder .Setup(b => b.BuildScores(It.IsAny<IEnumerable<Tuple<int, int>>>())) .Returns(TestHelper.GetRandomFrameScores); var bowlingLine = new BowlingLine(new List<BowlingLineScore>{playerScore}); //act _underTest.CalculateScores(bowlingLine); //assert _scoreParser .Verify(p => p.ParseScores(It.IsAny<string>()), Times.Once); }
public void ShouldCallScoreCalculator() { //arrange InstantiateUnderTest(); var playerScore = new BowlingLineScore("test", TestHelper.AllStrikes); var scores =TestHelper.GetParsedScoresForAllStrikes(); _scoreParser.Setup(p => p.ParseScores(It.IsAny<string>())) .Returns(scores); _bowlingFrameBuilder.Setup(fb => fb.BuildScores(It.IsAny<IEnumerable<Tuple<int, int>>>())) .Returns(TestHelper.GetAllFramesAsStrikes()); var bowlingLine = new BowlingLine(new List<BowlingLineScore> { playerScore }); //act _underTest.CalculateScores(bowlingLine); //assert _scoreCalculator .Verify(calc=>calc.CalculateTotalScore(It.IsAny<List<IFrame>>()),Times.Once); }
public void FullLine(uint[] rolls, uint?expectedScore) { var score = BowlingLine.SubmitRolls(rolls); Assert.AreEqual(expectedScore, score); }
public void RollsAfterDoubleStrike(uint roll1, uint roll2, uint?expectedScore) { var score = BowlingLine.SubmitRolls(new uint[] { 10u, 10u, roll1, roll2 }); Assert.AreEqual(expectedScore, score); }
public void RollsAfterSpare(uint roll1, uint roll2, uint?expectedScore) { var score = BowlingLine.SubmitRolls(new uint[] { 5u, 5u, roll1, roll2 }); Assert.AreEqual(expectedScore, score); }
public void SingleFrameStrike() { var score = BowlingLine.SubmitRolls(new uint[] { 10u }); Assert.AreEqual(null, score); }
public void SingleFrame(uint roll1, uint roll2, uint?expectedScore) { var score = BowlingLine.SubmitRolls(new uint[] { roll1, roll2 }); Assert.AreEqual(expectedScore, score); }