示例#1
0
 private static Frame FrameFactory(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 FrameFactory(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 LastFrameShouldSimplyCountItsScoreAsThreeBallsSum()
        {
            //given
            var lastFrame = new LastFrame(1, 2, 3);

            //when
            var score = lastFrame.Score;

            //then
            Assert.AreEqual(6, score);
        }
示例#4
0
        public void FrameShouldCountItsScoreWithNext2BallsAsBonusWhenNextFrameIsLast()
        {
            //given
            var frame = new Frame(10, 0);
            var nextFrame = new LastFrame(10, 3, 4);
            frame.Next = nextFrame;

            //when
            var score = frame.Score;

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