Esempio n. 1
0
        public void ScoreBoardShouldCalculateTotalScoreWhenLastFrameHasSpare()
        {
            //given
            var scoreBoard = new ScoreBoard();

            //when
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(2, 3); //5
            scoreBoard.Play(3, 4); //7
            scoreBoard.Play(5, 5); //11
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(10, 0); //20
            scoreBoard.Play(7, 3); //11
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(10, 0); //20
            scoreBoard.Play(1, 9, 2); //12

            var total = scoreBoard.TotalScore;
            //then
            Assert.AreEqual(95, total);
        }
Esempio n. 2
0
        public void ScoreBoardShouldCalculateTotalScoreOf10Frames()
        {
            //given
            var scoreBoard = new ScoreBoard();

            //when
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(2, 3); //5
            scoreBoard.Play(3, 4); //7
            scoreBoard.Play(5, 5); //11
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(10, 0); //20
            scoreBoard.Play(7, 3); //11
            scoreBoard.Play(1, 2); //3
            scoreBoard.Play(10, 0); //13
            scoreBoard.Play(1, 2); //3

            var total = scoreBoard.TotalScore;
            //then
            Assert.AreEqual(79, total);
        }
Esempio n. 3
0
        public void ScoreBoardShouldCalculateTotalOfPerfectGame()
        {
            //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);

            var total = scoreBoard.TotalScore;
            //then
            Assert.AreEqual(300, total);
        }
Esempio n. 4
0
 public void LastFrameMustBeLast()
 {
     var scoreBoard = new ScoreBoard();
     scoreBoard.Play(1, 1, 1);
 }
Esempio n. 5
0
        public void ScoreBoardShouldNotHaveMoreThan10Frames()
        {
            var scoreBoard = new ScoreBoard();

            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, 0);
            scoreBoard.Play(10, 0);
        }