ThirdTry.ScoreBoard.Play C# (CSharp) Method

Play() public method

public Play ( int firstBall, int secondBall, int thirdBall = -1 ) : void
firstBall int
secondBall int
thirdBall int
return void
        public void Play(int firstBall, int secondBall, int thirdBall = -1)
        {
            var frame = FrameFactory(firstBall, secondBall, thirdBall);
            if (frames.Count > 0)
            {
                frames.Last().Next = frame;
            }
            frames.Add(frame);
        }

Usage Example

Beispiel #1
0
        public void ScoreBoardShouldCountScoreOfPerfectGame()
        {
            //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);
        }
All Usage Examples Of ThirdTry.ScoreBoard::Play