コード例 #1
0
 public void ScoreWithSpare()
 {
     var game = new Game();
     for (int i = 0; i < 10; i++)
     {
         game.Roll(2);
     }
     game.Roll(1);
     game.Roll(9);
     for (int i = 12; i < 20; i++)
     {
         game.Roll(2);
     }
     Assert.AreEqual(48, game.Score());
 }
コード例 #2
0
 public void ScoreWithoutStrickesAndSpares()
 {
     var game = new Game();
     for (int i = 0; i < 20; i++)
     {
         game.Roll(4);
     }
     Assert.AreEqual(80, game.Score());
 }
コード例 #3
0
 public void NoScore()
 {
     var game = new Game();
     for (int i = 0; i < 20; i++)
     {
         game.Roll(0);
     }
     Assert.AreEqual(0, game.Score());
 }
コード例 #4
0
 public void ScoreWithMultipleNotConsecutiveSpares()
 {
     var game = new Game();
     game.Roll(1);
     game.Roll(9);
     for (int i = 2; i < 10; i++)
     {
         game.Roll(2);
     }
     game.Roll(1);
     game.Roll(9);
     for (int i = 12; i < 20; i++)
     {
         game.Roll(2);
     }
     Assert.AreEqual(56, game.Score());
 }
コード例 #5
0
        public void ScoreWithStrike()
        {
            var game = new Game();

            for (int i = 0; i < 10; i++)
            {
                game.Roll(2);
            }

            game.Roll(10);

            for (int i = 11; i < 19; i++)
            {
                game.Roll(2);
            }
            Assert.AreEqual(50, game.Score());
        }
コード例 #6
0
        public void ScoreWithTwoConsecutiveStrikes()
        {
            var game = new Game();

            for (int i = 0; i < 10; i++)
            {
                game.Roll(2);
            }

            game.Roll(10);
            game.Roll(10);

            for (int i = 12; i < 18; i++)
            {
                game.Roll(2);
            }
            Assert.AreEqual(66, game.Score());
        }