Exemplo n.º 1
0
        public void IllegalFrames_1_Test()
        {
            BowlingFrame[] frames = GameTriesTests.GenerateFrames(
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, BowlingGameExtenstions.NUM_OF_PINS),
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0),
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0),
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, BowlingGameExtenstions.NUM_OF_PINS));

            ScoreCard scoreCard = new ScoreCard(frames);

            Assert.IsFalse(Game.IsValid(scoreCard));
        }
Exemplo n.º 2
0
        public void CheckIfReachedToEndGame_3_Test()
        {
            BowlingFrame[] frames = GameTriesTests.GenerateFrames(
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 3),
                new Tuple <int, int>(5, 4),
                new Tuple <int, int>(5, 2),
                new Tuple <int, int>(5, 2),
                new Tuple <int, int>(5, 3),
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0)); // Strike

            ScoreCard scoreCard = new ScoreCard(frames);

            Assert.IsTrue(Game.IsEligibleForAnotherTry(scoreCard));
        }
Exemplo n.º 3
0
        public void IllegealLastRound_Spare_1_Test()
        {
            BowlingFrame[] frames = GameTriesTests.GenerateFrames(
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 5),
                new Tuple <int, int>(5, 3),
                new Tuple <int, int>(5, 4),
                new Tuple <int, int>(5, 2),
                new Tuple <int, int>(5, 2),
                new Tuple <int, int>(5, 3),
                new Tuple <int, int>(3, 7), // spare
                new Tuple <int, int>(5, 3));

            ScoreCard scoreCard = new ScoreCard(frames);

            Assert.IsFalse(Game.IsValid(scoreCard));
        }
Exemplo n.º 4
0
        public void LegealLastRound_Strike_2_Test()
        {
            BowlingFrame[] frames = GameTriesTests.GenerateFrames(
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0), //20
                new Tuple <int, int>(5, 5),                                  //15
                new Tuple <int, int>(5, 5),                                  //15
                new Tuple <int, int>(5, 5),                                  //15
                new Tuple <int, int>(5, 3),                                  // 8
                new Tuple <int, int>(5, 4),                                  // 9
                new Tuple <int, int>(5, 2),                                  // 7
                new Tuple <int, int>(5, 2),                                  // 7
                new Tuple <int, int>(5, 3),                                  // 8
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, 0), // Strike // 30
                new Tuple <int, int>(BowlingGameExtenstions.NUM_OF_PINS, BowlingGameExtenstions.NUM_OF_PINS));

            ScoreCard scoreCard = new ScoreCard(frames);

            Assert.IsTrue(Game.IsValid(scoreCard));
            Assert.AreEqual(134, Game.GetScore(scoreCard));
        }