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

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(5, score);
        }
Beispiel #2
0
        public void FrameShouldCountBonusOfNextBallWhenThereIsSpare()
        {
            //given
            var frame = new Frame(3, 7);
            var nextFrame = new Frame(3, 3);
            frame.NextFrame = nextFrame;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(13, score);
        }
Beispiel #3
0
        public void FrameShouldCountBonusOfNextTwoBallsInNextFrameWhenThereIsStrike()
        {
            //given
            var frame = new Frame(10, 0);
            var nextFrame = new Frame(3, 3);
            frame.NextFrame = nextFrame;

            //when
            var score = frame.Score;

            //then
            Assert.AreEqual(16, score);
        }
Beispiel #4
0
 private static Frame CreateFrame(int firstBall, int secondBall, int thirdBall)
 {
     Frame frame = null;
     if (thirdBall != -1)
     {
         frame = new LastFrame(firstBall, secondBall, thirdBall);
     }
     else
     {
         frame = new Frame(firstBall, secondBall);
     }
     return frame;
 }
Beispiel #5
0
        public void FrameShouldCountBonusOfNextTwoBallsInNextTwoFramesWhenThereAreConsectiveStrikes()
        {
            //given
            var frame = new Frame(10, 0);
            var nextFrame = new Frame(10, 0);
            var secondToNextFrame = new Frame(3, 3);
            frame.NextFrame = nextFrame;
            nextFrame.NextFrame = secondToNextFrame;

            //when
            var score = frame.Score;

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