public void Strike()
        {
            RegularFrame myFrame = new RegularFrame(10);

            myFrame.AddBallScore(10, strike: true);
            Assert.IsTrue(myFrame.IsStrike);
        }
        public void Successful_Empty_Tenth_Frame()
        {
            RegularFrame myFrame = new RegularFrame(10);

            Assert.IsNotNull(myFrame);
            Assert.IsTrue(myFrame.FrameNumber == 10);
        }
        public void Add_Bonus_Points_To_Strike()
        {
            RegularFrame myFrame = new RegularFrame(10);

            myFrame.AddBallScore(10, strike: true);
            myFrame.AddBonusPoints(10);
            Assert.AreEqual(20, myFrame.GetScore());
        }
        public void Spare()
        {
            RegularFrame myFrame = new RegularFrame(10);

            myFrame.AddBallScore(4);
            myFrame.AddBallScore(6, spare: true);
            Assert.IsTrue(myFrame.IsSpare);
        }
        public void Add_Rolls_To_Existing_Frame()
        {
            RegularFrame myFrame = new RegularFrame(1);

            myFrame.AddBallScore(5);
            myFrame.AddBallScore(5);
            Assert.AreEqual(10, myFrame.GetScore());
        }
        public void Add_Bonus_Points_To_Spare()
        {
            RegularFrame myFrame = new RegularFrame(10);

            myFrame.AddBallScore(5);
            myFrame.AddBallScore(5, spare: true);
            myFrame.AddBonusPoints(6);
            Assert.AreEqual(16, myFrame.GetScore());
        }
        public void Score_And_Mark_Frame5()
        {
            int    expectedValue = 4;
            IFrame frame         = new RegularFrame(1);
            TenPin game          = new TenPin();
            int    score         = game.AddBallScoresToFrameAndMarkFrameForLaterBonusPoints(frame, "4-");

            Assert.AreEqual(expectedValue, score);
            Assert.AreEqual(expectedValue, frame.GetScore());
            Assert.IsTrue(frame.ScoreNextNumBalls == 0);
        }
        public void Frame_Eleven_Invalid()
        {
            try
            {
                RegularFrame myFrame = new RegularFrame(11);
            }

            catch (Exception e)
            {
                Assert.IsTrue(e.Message.Equals("Invalid frame number 11, must be between 1 and 10"));
            }
        }
        public void Score_And_Mark_Frame2()
        {
            int    expectedValue = 20;
            IFrame frame         = new RegularFrame(1);
            TenPin game          = new TenPin();
            int    score         = game.AddBallScoresToFrameAndMarkFrameForLaterBonusPoints(frame, "XX");

            Assert.AreEqual(expectedValue, score);
            Assert.AreEqual(expectedValue, frame.GetScore());
            //because the frame isn't actually part of the collection of frames in the game it doesn't get the "bonus points" for the second ball
            Assert.IsTrue(frame.ScoreNextNumBalls == 2);
        }
        public void Score_And_Mark_Frame6()
        {
            int    expectedValue = 10;
            IFrame frame         = new RegularFrame(1);
            TenPin game          = new TenPin();
            int    score         = game.AddBallScoresToFrameAndMarkFrameForLaterBonusPoints(frame, "46");

            //the scorecard SHOULD have marked this as "4/" for the spare, but we want to make sure that unless it is
            //specifically marked as a spare don't set it to add in bonus points later
            Assert.AreEqual(expectedValue, score);
            Assert.AreEqual(expectedValue, frame.GetScore());
            Assert.IsTrue(frame.ScoreNextNumBalls == 0);
        }
        public void ShouldReturnFrameScore()
        {
            //arrange
            Ball         ball1  = new Ball(4);
            Ball         ball2  = new Ball(3);
            RegularFrame frame  = new RegularFrame(ball1, ball2);
            Score        score2 = new Score(7);
            //act
            Score frameScore = frame.TotalScore();

            //assert
            frameScore.Should().Be(score2);
        }
        public void ShouldGetAdditionAllBallScoreForStrike()
        {
            //arrange
            IFrame frame1        = new StrikeFrame();
            IFrame frame2        = new RegularFrame(new Ball(4), new Ball(3));
            Score  expectedScore = new Score(17);

            frame1.AddNextFrame(frame2);
            //act
            Score actualScore = frame1.TotalScore();

            //assert
            actualScore.Should().Be(expectedScore);
        }
        public void ShouldnotGetBonusBallScoreForStrikeNotIn10ThFrame()
        {
            //arrange
            IFrame frame1 = new StrikeFrame();
            IFrame frame3 = new RegularFrame(new Ball(3), new Ball(3));

            frame1.AddNextFrame(frame3);
            frame1.AddBonusBalls(new BonusBall(10), new BonusBall(5));
            Score expectedScore = new Score(16);
            //act
            Score actualScore = frame1.TotalScore();

            //assert
            actualScore.Should().Be(expectedScore);
        }
        public void ShouldScoreGameWithStrike()
        {
            //arrange
            Game   game        = new Game();
            IFrame strikeFrame = new StrikeFrame();
            IFrame frame2      = new RegularFrame(new Ball(3), new Ball(4));

            game.AddFrame(strikeFrame);
            game.AddFrame(frame2);
            AddFramesWithScore(game, 8);
            Score expectedScore = new Score(24);
            //act
            Score actualScore = game.ScoreGame();

            //assert
            actualScore.Should().Be(expectedScore);
        }