コード例 #1
0
 public void Setup()
 {
     bowlingGame = new BowlingGame();
 }
コード例 #2
0
        public void When_all_rolls_are_strikes()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(Enumerable.Repeat(10, 12).ToArray()) == 300);
        }
コード例 #3
0
        public void Random_Game_Scores()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(new[] { 10, 7, 2, 3, 4, 1, 1, 3, 6, 10, 8, 1, 10, 10, 9, 1, 10 }) == 143);
        }
コード例 #4
0
        public void When_all_rolls_are_spares()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(Enumerable.Repeat(5, 21).ToArray()) == 150);
        }
コード例 #5
0
        public void When_rolling_a_single_strike_and_score_full_frame()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(new[] { 10, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) == 14);
        }
コード例 #6
0
        public void When_rolling_a_single_strike()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(new[] { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) == 10);
        }
コード例 #7
0
        public void When_rolling_a_single_spare_and_score()
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(new[] { 9, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) == 12);
        }
コード例 #8
0
        public void When_all_rolls_are_the_same_no_extra_frames(int roll, int score)
        {
            BowlingGame game = new BowlingGame();

            Assert.That(game.Score(Enumerable.Repeat(roll, 20).ToArray()) == score);
        }