Roll() public method

public Roll ( int pins ) : void
pins int
return void
示例#1
0
        [TestMethod] // 7
        public void StrikeFirstFrameGuttersRest()
        {
            var game = new Game();

            game.Roll(10);
            SimulateRoll(game, 19, 0);
            Assert.AreEqual(10, game.Score());
        }
示例#2
0
 private void RollMany(int numberRoll, int pinsKnocked)
 {
     for (var i = 0; i < numberRoll; i++)
     {
         _game.Roll(pinsKnocked);
     }
 }
示例#3
0
 private void RollMany(int n, int pins)
 {
     for (int i = 0; i < n; i++)
     {
         game.Roll(pins);
     }
 }
 public void TestOneSpare()
 {
     rollSpare();
     g.Roll(3);
     RollMany(17, 0);
     Assert.Equal(16, g.TotalScore);
 }
示例#5
0
        public static Game RollMany(this Game game, int rolls, ushort pins)
        {
            for (var i = 0; i < rolls; i++)
            {
                game.Roll(pins);
            }

            return(game);
        }
示例#6
0
        public void TestOneSpare()
        {
            _game.Roll(3);
            _game.Roll(7);
            _game.Roll(3);
            ProcessRolling(17, 0);

            Assert.AreEqual(16, _game.GetScore());
        }
示例#7
0
        [TestMethod] // 13
        public void AllSpares()
        {
            var game = new Game();

            for (int i = 0; i < 21; i++)
            {
                game.Roll(5);
            }

            Assert.AreEqual(150, game.Score());
        }
示例#8
0
        [TestMethod] // 9
        public void ThreeConsecutiveStrikesPlusTwoBallBonusThenGutters()
        {
            var game = new Game();

            game.Roll(10);
            game.Roll(10);
            game.Roll(10);
            game.Roll(5);
            game.Roll(0);
            game.Roll(5);
            game.Roll(0);
            SimulateRoll(game, 10, 0);
        }
示例#9
0
文件: GameTests.cs 项目: jaknor/Katas
        public void RollAndHitInvalidNumberOfPins(int numberOfPinsKnockedDown)
        {
            // Given too many pins in a roll
            _game.Roll(numberOfPinsKnockedDown);

            // The game ignores the roll and does not give any score
            Assert.Equal(0, _game.Score());
        }
示例#10
0
        public void Score_UserGetsPinsWithOnlyOnePin_ReturnsTwenty()
        {
            Game game = new Game();

            for (int i = 1; i <= 20; i++)
                game.Roll(1);

            Assert.That(game.Score, Is.EqualTo(20));
        }
示例#11
0
        public void Score_UserGetsNoPoint_ReturnsZero()
        {
            Game game = new Game();

            for (int i = 1; i <= 20; i++)
                game.Roll(0);

            Assert.That(game.Score, Is.EqualTo(0));
        }
示例#12
0
        public void Score_TwoStrikes_AndRestOne()
        {
            Game game = new Game();
            game.Roll(10);
            game.Roll(10);
            for (int i = 1; i <= 16; i++)
                game.Roll(1);

            Assert.That(game.Score, Is.EqualTo(49));
        }
示例#13
0
 public void Score_PerfectGame_ResultIs300()
 {
     Game game = new Game();
     for (int i = 1; i <= 12; i++)
         game.Roll(10);
     Assert.That(game.Frames.Count,Is.EqualTo(10));
     Assert.That(game.Score, Is.EqualTo(300));
 }
示例#14
0
        public void Score_Game_With_Spares_Only()
        {
            Game game = new Game();

            for (int i = 1; i <= 21; i++)
                game.Roll(5);

            Assert.That(game.Score, Is.EqualTo(150));
        }
示例#15
0
        public void Score_Game_With_Nines_And_Miss_Only()
        {
            Game game = new Game();

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

            Assert.That(game.Score, Is.EqualTo(90));
        }
示例#16
0
 public static void Main(string[] args)
 {
     var game = new Game();
     game.Roll(12);
 }
示例#17
0
 public static void TakeOneRoll(this Game game, int roll)
 {
     game.Roll(roll);
 }
示例#18
0
 public static void TakeTwoRolls(this Game game, int firstRoll, int seconeRoll)
 {
     game.Roll(firstRoll);
     game.Roll(seconeRoll);
 }