Ejemplo n.º 1
0
            public void GivenPerfectGame_ShouldReturn300()
            {
                //arrange
                var game = new GameBuilder()
                           .WithXRolls(12, 10)
                           .Build();
                //act
                var actual = game.Score();

                //assert;
                actual.Should().Be(300);
            }
Ejemplo n.º 2
0
            public void Given20SinglePinRolls_ShouldReturn20()
            {
                //arrange
                var game = new GameBuilder()
                           .WithXRolls(20, 1)
                           .Build();
                //act
                var actual = game.Score();

                //assert;
                actual.Should().Be(20);
            }
Ejemplo n.º 3
0
            public void Given1PinAndRestGutters_ShouldReturn1()
            {
                //arrange
                var game = new GameBuilder()
                           .WithRoll(1)
                           .WithRestOfGameAllGutterBalls()
                           .Build();
                //act
                var actual = game.Score();

                //assert;
                actual.Should().Be(1);
            }
Ejemplo n.º 4
0
                public void GivenRoll1IsStrike_Only18FurtherGuttersAreNeedForACompleteGame()
                {
                    //arrange
                    var game = new GameBuilder()
                               .WithRoll(10)
                               .WithXGutterBalls(18)
                               .Build();
                    //act
                    var actual = game.Score();

                    //assert;
                    actual.Should().Be(10);
                }
Ejemplo n.º 5
0
                public void GivenFrame1IsSpare_RestAreGutters_ShouldReturn10()
                {
                    //arrange
                    var game = new GameBuilder()
                               .WithRoll(4)
                               .WithRoll(6)
                               .WithRestOfGameAllGutterBalls()
                               .Build();
                    //act
                    var actual = game.Score();

                    //assert;
                    actual.Should().Be(10);
                }
Ejemplo n.º 6
0
            public void GivenOnly18GutterBallRolls_ShouldThrow()
            {
                //arrange
                var game = new GameBuilder()
                           .WithXGutterBalls(18)
                           .Build();

                //act
                //assert;
                game.Invoking(g => g.Score())
                .Should()
                .Throw <InvalidOperationException>()
                .WithMessage("Incomplete Game*");
            }
Ejemplo n.º 7
0
                public void Given18GutterBalls_And3_And7_Adds1ExtraRoll_ShouldReturn11()
                {
                    //arrange
                    var game = new GameBuilder()
                               .WithXGutterBalls(18)
                               .WithRoll(3)
                               .WithRoll(7)
                               .WithRoll(1)
                               .Build();
                    //act
                    var actual = game.Score();

                    //assert;
                    actual.Should().Be(11);
                }
Ejemplo n.º 8
0
                public void Given18GutterBalls_AndStrike_Adds2ExtraRolls_ShouldReturn12()
                {
                    //arrange
                    var game = new GameBuilder()
                               .WithXGutterBalls(18)
                               .WithRoll(10)
                               .WithRoll(1)
                               .WithRoll(1)
                               .Build();
                    //act
                    var actual = game.Score();

                    //assert;
                    actual.Should().Be(12);
                }
Ejemplo n.º 9
0
                public void GivenRoll1IsStrike_Frame2_4And4_RestGutters_ShouldReturn()
                {
                    //arrange
                    var game = new GameBuilder()
                               .WithRoll(10)
                               .WithRoll(4)
                               .WithRoll(4)
                               .WithRestOfFramesAllGutterBalls()
                               .Build();
                    //act
                    var actual = game.Score();

                    //assert;
                    actual.Should().Be(26);
                }