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; }
public void FrameShouldCountItsOwnScoreWithoutBonus() { //given var frame = new Frame(1, 2); //when var score = frame.Score; //then Assert.AreEqual(3, score); }
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); }
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); }
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); }