Example #1
0
        public void FrameShouldCountScoreWhenThereIsNoBonus()
        {
            //given
            var frame = new Frame(2, 3);

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(5, score);
        }
Example #2
0
        public void FrameShouldIncludeNextTwoBallsAsBonusWhenThereIsStrike()
        {
            //given
            var frame = new Frame(10, 0);
            var frame2 = new Frame(3, 4);
            frame.Next = frame2;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(17, score);
        }
Example #3
0
        public void FrameShouldIncludeNextTwoBallsAsBonusWhenNextToStrikeIsLastFrame()
        {
            //given
            var frame = new Frame(10, 0);
            var frame2 = new LastFrame(10, 3, 4);
            frame.Next = frame2;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(23, score);
        }
Example #4
0
        public void FrameShouldIncludeNextOneBallAsBonusWhenThereIsSpare()
        {
            //given
            var frame = new Frame(2, 8);
            var frame2 = new Frame(3, 4);
            frame.Next = frame2;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(13, score);
        }
Example #5
0
 private Frame CreateFrame(int firstBall, int secondBall, int thirdBall)
 {
     Frame frame;
     if (thirdBall == -1)
     {
         frame = new Frame(firstBall, secondBall);
     }
     else
     {
         CheckLastPosition();
         frame = new LastFrame(firstBall, secondBall, thirdBall);
     }
     return frame;
 }
Example #6
0
        public void FrameShouldIncludeNextTwoBallsAsBonusWhenThereAre2StrikesInARow()
        {
            //given
            var frame = new Frame(10, 0);
            var frame2 = new Frame(10, 0);
            var frame3 = new Frame(3, 4);
            frame.Next = frame2;
            frame2.Next = frame3;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(23, score);
        }
Example #7
0
 public void FrameShouldNotHaveTwoBallsSumBiggerThan10()
 {
     var frame = new Frame(7, 5);
     var score = frame.Score;
 }
Example #8
0
 public void FrameShouldNotHaveAnyBallBiggerThan10()
 {
     var frame = new Frame(11, 12);
     var score = frame.Score;
 }