Play() public method

public Play ( int firstBall, int secondBall, int thirdBall = -1 ) : void
firstBall int
secondBall int
thirdBall int
return void
Beispiel #1
0
        public void ScoreBoardShouldCountTotalScoreOfPerfectGame()
        {
            //given
            var scoreBoard=new ScoreBoard();

            //when
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,0);
            scoreBoard.Play(10,10,10);

            //then
            Assert.AreEqual(300,scoreBoard.TotalScore);
        }
Beispiel #2
0
        public void ScoreBoardShouldCountTotalScoreOfWhenLastFrameHas3Balls()
        {
            //given
            var scoreBoard=new ScoreBoard();

            //when
            scoreBoard.Play(1,2);//3
            scoreBoard.Play(2,2);//4
            scoreBoard.Play(3,2);//5
            scoreBoard.Play(4,6);//10+1
            scoreBoard.Play(1,2);//3
            scoreBoard.Play(5,5);//10+1
            scoreBoard.Play(1,9);//10+7
            scoreBoard.Play(7,2);//9
            scoreBoard.Play(3,6);//9
            scoreBoard.Play(1,9,2);//12

            //then
            Assert.AreEqual(84,scoreBoard.TotalScore);
        }
Beispiel #3
0
        public void ScoreBoardShouldCountTotalScoreOf10Frames()
        {
            //given
            var scoreBoard=new ScoreBoard();

            //when
            scoreBoard.Play(1,2);//3
            scoreBoard.Play(2,2);//4
            scoreBoard.Play(3,2);//5
            scoreBoard.Play(4,6);//10+1
            scoreBoard.Play(1,2);//3
            scoreBoard.Play(5,5);//10+1
            scoreBoard.Play(1,9);//10+7
            scoreBoard.Play(7,2);//9
            scoreBoard.Play(3,6);//9
            scoreBoard.Play(1,2);//3

            //then
            Assert.AreEqual(75,scoreBoard.TotalScore);
        }