public void OneStrikeBonusScore() { var points = new int[] { 10, // Round 1 3, 5, // Round 2 7, 1, // Round 3 1, 1, // Round 4 2, 5, // Round 5 9, 0, // Round 6 2, 3, // Round 7 4, 4, // Round 8 3, 6, // Round 9 1, 4, // Round 10 -1, -1, -1 // No additional throws }; BowlingScore score = new BowlingScore(name, points); IBowling bowling = new SimpleBowling(); bowling.CountScore(ref score); int finalScore = score.Score; Assert.AreEqual(79, finalScore); }
public void TooManyKnockDownedThePinsInOneRound() { var points = new int[] { 1, 9, // Round 1 9, 9, // Round 2 <- 18 the pins knock downed in one round 1, 9, // Round 3 1, 9, // Round 4 1, 9, // Round 5 1, 9, // Round 6 1, 9, // Round 7 1, 9, // Round 8 1, 9, // Round 9 1, 9, // Round 10 9, // Addiontal throw -1 // No additional throw }; BowlingScore score = new BowlingScore(name, points); IBowling bowling = new SimpleBowling(); Assert.ThrowsException <ArgumentOutOfRangeException>(() => { bowling.CountScore(ref score); }); }
public void PerfectGameScore() { var points = new int[] { 10, // Round 1 10, // Round 2 10, // Round 3 10, // Round 4 10, // Round 5 10, // Round 6 10, // Round 7 10, // Round 8 10, // Round 9 10, // Round 10 10, 10, // Addiontal throws -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // No additional throws }; BowlingScore score = new BowlingScore(name, points); IBowling bowling = new SimpleBowling(); bowling.CountScore(ref score); int finalScore = score.Score; Assert.AreEqual(300, finalScore); }
public void BadDataShouldThrowException() { var points = new int[] { 1, 9, // Round 1 -1, 9, // Round 2 <- -1 in this place is bad data 1, 9, // Round 3 1, 9, // Round 4 1, 9, // Round 5 1, 9, // Round 6 1, 9, // Round 7 1, 9, // Round 8 1, 9, // Round 9 1, 9, // Round 10 9, // Addiontal throw -1 // No additional throw }; BowlingScore score = new BowlingScore(name, points); IBowling bowling = new SimpleBowling(); Assert.ThrowsException <ArgumentOutOfRangeException>(() => { bowling.CountScore(ref score); }); }
public void OnlySpareBonusScore() { var points = new int[] { 1, 9, // Round 1 1, 9, // Round 2 1, 9, // Round 3 1, 9, // Round 4 1, 9, // Round 5 1, 9, // Round 6 1, 9, // Round 7 1, 9, // Round 8 1, 9, // Round 9 1, 9, // Round 10 9, // Addiontal throw -1 // No additional throw }; BowlingScore score = new BowlingScore(name, points); IBowling bowling = new SimpleBowling(); bowling.CountScore(ref score); int finalScore = score.Score; Assert.AreEqual(118, finalScore); }