상속: Frame
예제 #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
        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);
        }
예제 #3
0
        public void LastFrameShouldSimplyAddUpAllItsBalls()
        {
            //given
            var lastFrame=new LastFrame(1,9,2);

            //when
            int score= lastFrame.Score;

            //then
            Assert.AreEqual(12,score);
        }
예제 #4
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);
        }