Play() публичный Метод

public Play ( int firstBall, int secondBall, int thirdBall = -1 ) : void
firstBall int
secondBall int
thirdBall int
Результат void
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #4
0
 public void LastFrameMustBeLast()
 {
     var scoreBoard = new ScoreBoard();
     scoreBoard.Play(1, 1, 1);
 }
Пример #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);
        }