예제 #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
        public void FrameShouldCountItsOwnScoreWithoutBonus()
        {
            //given
            var frame = new Frame(1, 2);

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(3, score);
        }
예제 #3
0
        public void FrameShouldCountItsScoreWithNextBallAsBonusWhenThereIsSpare()
        {
            //given
            var frame = new Frame(4, 6);
            var nextFrame = new Frame(2, 3);
            frame.Next = nextFrame;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(12, score);
        }
예제 #4
0
        public void FrameShouldCountItsScoreWithNext2BallsAsBonusWhenThereIsStrike()
        {
            //given
            var frame = new Frame(10, 0);
            var nextFrame = new Frame(2, 3);
            frame.Next = nextFrame;

            //when
            var score = frame.Score;

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