コード例 #1
0
        public void GetFrameScoreScenario3Game10IsStrikeAllowstwoMoreBalls()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);


            Assert.AreEqual(300, game.GetScores());
            Assert.AreEqual(0, game.GetRemainingBonusBalls());
            Assert.AreEqual(10, game.GetActiveFrameNumber());

            game.RollBall(10);// this ball should be ignored...
            Assert.AreEqual(300, game.GetScores());
            Assert.AreEqual(0, game.GetRemainingBonusBalls());
            Assert.AreEqual(10, game.GetActiveFrameNumber());
        }
コード例 #2
0
        public void StrikeGivesYouTwoBonusBalls()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);

            int actualFrameNumber   = game.GetActiveFrameNumber();
            int expectedFrameNumber = 2;

            int actualBonusBalls   = game.GetRemainingBonusBalls();
            int expectedBonusBalls = 2;

            Console.WriteLine("Actual Frame" + actualFrameNumber);
            Console.WriteLine("Actual BonusBalls" + actualBonusBalls);
            Assert.AreEqual(expectedFrameNumber, actualFrameNumber);
            Assert.AreEqual(expectedBonusBalls, actualBonusBalls);
        }
コード例 #3
0
        public void GetScorseWhenAStrike()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);

            int actualFrameNumber   = game.GetActiveFrameNumber();
            int expectedFrameNumber = 2;

            int actualBonusBalls   = game.GetRemainingBonusBalls();
            int expectedBonusBalls = 2;

            Console.WriteLine("Actual Frame" + actualFrameNumber);
            Console.WriteLine("Actual BonusBalls" + actualBonusBalls);
            Assert.AreEqual(expectedFrameNumber, actualFrameNumber);
            Assert.AreEqual(expectedBonusBalls, actualBonusBalls);
            int actualScore   = game.GetScores();
            int expectedScore = 10;

            Assert.AreEqual(expectedScore, actualScore);
        }
コード例 #4
0
        public void GetFrameScoreScenario3Game10IsStrikeAllowsOneMoreBalls()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(10);
            game.RollBall(2); //9
            game.RollBall(8); //9
            game.RollBall(2);
            game.RollBall(8);
            game.RollBall(10);

            game.PrintScores();

            // Assert.AreEqual(278, game.GetScores());
            Assert.AreEqual(0, game.GetRemainingBonusBalls());
            Assert.AreEqual(10, game.GetActiveFrameNumber());
        }