コード例 #1
0
        public void ShouldReturnGameOverMessageWhenAllFramesDone()
        {
            var    ab     = new ScoreDisplayer();
            string result = string.Empty;

            for (int i = 0; i < 22; i++)
            {
                result = ab.DisplayScore(5);
            }

            Assert.That(result, Is.EqualTo("5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t\n15\t\t15\t\t15\t\t15\t\t15\t\t15\t\t15\t\t15\t\t15\t\t15\t\t\nGame Over!"));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello World");
            var scoreDisplayer = new ScoreDisplayer();

            var score = string.Empty;

            while (!score.Contains("Game Over!"))
            {
                var pinCount = System.Console.ReadLine();
                score = scoreDisplayer.DisplayScore(Convert.ToInt32(pinCount));
                System.Console.WriteLine(score);
            }
        }
コード例 #3
0
    private void OnBoardFinished(GameplayBoard board, TargetTrigger trigger, bool success)
    {
        SwitchBoards(board, trigger);

        if (success)
        {
            _currentScore++;
            _scoreDisplayer.DisplayScore(_currentScore);

            CheckWin();
        }
        else
        {
            Finish(false);
        }
    }
コード例 #4
0
        public void ShouldReturnScoreOfMultiFrames()
        {
            var ab = new ScoreDisplayer();


            ab.DisplayScore(1);
            ab.DisplayScore(3);
            ab.DisplayScore(5);
            ab.DisplayScore(5);
            ab.DisplayScore(4);
            ab.DisplayScore(3);
            var result = ab.DisplayScore(1);

            Assert.That(result, Is.EqualTo("1\t3\t5\t5\t4\t3\t\n4\t\t14\t\t7\t\t"));
        }