Пример #1
0
 private static Frame CreateFrame(int firstBall, int secondBall, int thirdBall)
 {
     var frame = new Frame(firstBall, secondBall);
     if (thirdBall != -1)
     {
         frame = new LastFrame(firstBall, secondBall, thirdBall);
     }
     return frame;
 }
Пример #2
0
        public void FrameShouldCountScoreWhenThereIsNoBonus()
        {
            //given
            Frame frame=new Frame(2,3);

            //when
            int score=frame.Score;

            //then
            Assert.AreEqual(5,score);
        }
Пример #3
0
        public void NinethFrameShouldIncludeNext2BallsAsBonusWhenThereAre2ConsectiveStrikes()
        {
            //given
            Frame frame=new Frame(10,0);
            LastFrame frame2=new LastFrame(10,2,3);
            frame.Next = frame2;

            //when
            int score=frame.Score;

            //then
            Assert.AreEqual(22,score);
        }
Пример #4
0
        public void FrameShouldIncludeNext2BallsAsBonusWhenThereIsStrike()
        {
            //given
            Frame frame=new Frame(10,0);
            Frame frame2=new Frame(3,4);
            frame.Next = frame2;

            //when
            int score=frame.Score;

            //then
            Assert.AreEqual(17,score);
        }
Пример #5
0
        public void FrameShouldIncludeNext1BallAsBonusWhenThereIsSpare()
        {
            //given
            Frame frame=new Frame(2,8);
            Frame frame2=new Frame(3,4);
            frame.Next = frame2;

            //when
            int score=frame.Score;

            //then
            Assert.AreEqual(13,score);
        }
Пример #6
0
        public void FrameShouldIncludeNext2BallsAsBonusWhenThereAre2ConsectiveStrikes()
        {
            //given
            Frame frame=new Frame(10,0);
            Frame frame2=new Frame(10,0);
            Frame frame3=new Frame(3,4);
            frame.Next = frame2;
            frame2.Next = frame3;

            //when
            int score=frame.Score;

            //then
            Assert.AreEqual(23,score);
        }