Ejemplo n.º 1
0
 public void Test_DummyThrowNotInsertedAfterStrikeInSecondThrowOfFrame()
 {
     var game = new BowlingGame();
     game.Throw(0);
     game.Throw(10);
     Ashure.That(game.Print().Equals("0 10 | "));
 }
        public void Test10PairsOf9AndMiss()
        {
            var game = new BowlingGame();

            Repeat(() => { game.Roll(9); game.Roll(0); }, 10);

            Assert.Equal(90, game.Score);
        }
Ejemplo n.º 3
0
        public void Score_OneRoll_ShouldReturnRolledAmount()
        {
            BowlingGame game = new BowlingGame();

            game.Roll(3);

            Assert.Equal(3, game.Score());
        }
        public void TestRollsAllEmpty()
        {
            var game = new BowlingGame();

            Repeat(() => game.Roll(0), 20);

            Assert.Equal(0, game.Score);
        }
        public void TestBowlsAPerfectGame()
        {
            var game = new BowlingGame();

            Repeat(() => game.Roll(10), 12);

            Assert.Equal(300, game.Score);
        }
Ejemplo n.º 6
0
 public void Test_GameWith9ThrowsOfOnes_IsInFifthFrame()
 {
     var game = new BowlingGame();
     foreach (var one in Enumerable.Repeat(1, 9))
     {
         game.Throw(one);
     }
     Ashure.That(game.GetCurrentFrame().IsEqualTo(5));
 }
Ejemplo n.º 7
0
 public void Test_GameWith20ThrowsOf1_HasScoreTwenty()
 {
     var game = new BowlingGame();
     foreach (var one in Enumerable.Repeat(1, 20))
     {
         game.Throw(one);
     }
     Ashure.That(game.GetScore().Equals(20));
 }
        public void Test10PairsOf5AndSparePlus5()
        {
            var game = new BowlingGame();

            Repeat(() => game.Roll(5), 20);
            game.Roll(5);

            Assert.Equal(150, game.Score);
        }
        public void TestOnlyRollsStrikeInFirstFrame()
        {
            var game = new BowlingGame();

            Repeat(() => game.Roll(10), 1);
            Repeat(() => game.Roll(1), 18);

            Assert.Equal(10 + 1 + 1 + 18, game.Score);
        }
Ejemplo n.º 10
0
 public void Test_DummyThrowInsertedAfterStrikeInFirstThrowOSecondfFrame()
 {
     var game = new BowlingGame();
     // First frame
     game.Throw(1);
     game.Throw(1);
     // Second frame
     game.Throw(10);
     Ashure.That(game.Print().Equals("1 1 | 10 0 | "));
 }
Ejemplo n.º 11
0
 public void Test_PerfectGame_Scores300()
 {
     var game = new BowlingGame();
     foreach (var ten in Enumerable.Repeat(10, 12))
     {
         game.Throw(ten);
     }
     Ashure.That(game.GetScore().IsEqualTo(300));
 }
Ejemplo n.º 12
0
 public void Test_GameWithSingleThrowOfFive_HasScoreFive()
 {
     var game = new BowlingGame();
     game.Throw(5);
     Ashure.That(game.GetScore().Equals(5));
 }
Ejemplo n.º 13
0
 public void Test_GameWithNoThrows_HasScoreZero()
 {
     var game = new BowlingGame();
     Ashure.That(game.GetScore().Equals(0));
 }
Ejemplo n.º 14
0
 public void Test_Throwing21Fives_Scores150()
 {
     var game = new BowlingGame();
     foreach (var five in Enumerable.Repeat(5, 21))
     {
         game.Throw(five);
     }
     Ashure.That(game.GetScore().IsEqualTo(150));
 }
Ejemplo n.º 15
0
 public void Should_score_game_of_gutterballs(string game, int expected)
 {
     var score = new BowlingGame(game).GetScore();
     Assert.That(score, Is.EqualTo(expected));
 }
Ejemplo n.º 16
0
 public void Should_score_perfect_game()
 {
     var score = new BowlingGame("x,x,x,x,x,x,x,x,x,x").GetScore();
     Assert.That(score, Is.EqualTo(300));
 }
Ejemplo n.º 17
0
 public BowlingTest()
 {
     _game = new BowlingGame();
 }