Exemplo n.º 1
0
        public void GetFrameScoreScenario2BonusPointsAddedtoCorrectFrame()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);
            game.RollBall(4);
            game.RollBall(6);
            Assert.AreEqual(30, game.GetScores());
        }
Exemplo n.º 2
0
        public void TwoRollOfBallsStartsNewFrameTest()
        {
            // Means if you have rolled two balls, then the next frame will start..
            // third roll will be a start of next frame

            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(4);
            game.RollBall(3);
            int actual   = game.GetActiveFrameNumber();
            int expected = 2;

            Console.WriteLine(actual);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void GetFrameScoreScenario1()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(6);
            game.RollBall(4);

            Assert.AreEqual(10, game.GetScorebyFrame(1));

            game.RollBall(7);
            Assert.AreEqual(17, game.GetScorebyFrame(1));
            game.RollBall(1);
            Assert.AreEqual(17, game.GetScorebyFrame(1));
            Assert.AreEqual(8, game.GetScorebyFrame(2));
        }
Exemplo n.º 4
0
        public void SpareGivesYouABonusBallRoll()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(4);
            game.RollBall(6);
            int actualFrameNumber   = game.GetActiveFrameNumber();
            int expectedFrameNumber = 2;

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

            Console.WriteLine("Actual Frame" + actualFrameNumber);
            Console.WriteLine("Actual BonusBalls" + actualBonusBalls);
            Assert.AreEqual(expectedFrameNumber, actualFrameNumber);
            Assert.AreEqual(expectedBonusBalls, actualBonusBalls);
        }
Exemplo n.º 5
0
        public void OneRollOfBallDoesNotStartNewFrameIfAllPinsNotDownTest()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(4);
            int actual   = game.GetActiveFrameNumber();
            int expected = 1;

            Console.WriteLine(actual);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void GetScoresWhenASpare()
        {
            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(8);
            game.RollBall(2);

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

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

            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);
        }
Exemplo n.º 7
0
        public void OneRollOfBallStartNewFrameIfAllPinsDownTest()
        {
            // Means if you have rolled only one ball, then the next frame will not start..
            // third roll will be a start of next frame

            BowlingKataGame game = new BowlingKataGame();

            game.RollBall(10);
            int actual   = game.GetActiveFrameNumber();
            int expected = 2;

            Console.WriteLine(actual);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
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());
        }
Exemplo n.º 9
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());
        }