コード例 #1
0
        public void should_not_exception_when_create_10th_frame_more_than_10_point()
        {
            game.RollTheLastBowl(10, 10, 10);
            var score = game.FinalScore();

            Assert.AreEqual(score, 157);
        }
コード例 #2
0
        public void varify_score_for_each_frame_of_the_game3()
        {
            inputData = new List <short[]>
            {
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 10, 10 }
            };

            game = CreateNewGame();
            var score      = game.FinalScore();
            var gameFrames = game.Frames;

            Assert.AreEqual(gameFrames[1].Score, 30);
            Assert.AreEqual(gameFrames[2].Score, 60);
            Assert.AreEqual(gameFrames[3].Score, 90);
            Assert.AreEqual(gameFrames[4].Score, 120);
            Assert.AreEqual(gameFrames[5].Score, 150);
            Assert.AreEqual(gameFrames[6].Score, 180);
            Assert.AreEqual(gameFrames[7].Score, 210);
            Assert.AreEqual(gameFrames[8].Score, 240);
            Assert.AreEqual(gameFrames[9].Score, 270);
            Assert.AreEqual(gameFrames[10].Score, 300);

            Assert.AreEqual(score, 300);
        }
コード例 #3
0
        public void varify_score_for_each_frame_of_the_game4()
        {
            inputData = new List <short[]>
            {
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 7, 3 },
                new short[] { 8, 2 },
                new short[] { 10, 0 },
                new short[] { 9, 1 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 0 },
                new short[] { 10, 7, 3 }
            };

            game = CreateNewGame();
            var score      = game.FinalScore();
            var gameFrames = game.Frames;

            Assert.AreEqual(gameFrames[1].Score, 27);
            Assert.AreEqual(gameFrames[2].Score, 47);
            Assert.AreEqual(gameFrames[3].Score, 65);
            Assert.AreEqual(gameFrames[4].Score, 85);
            Assert.AreEqual(gameFrames[5].Score, 105);
            Assert.AreEqual(gameFrames[6].Score, 125);
            Assert.AreEqual(gameFrames[7].Score, 155);
            Assert.AreEqual(gameFrames[8].Score, 185);
            Assert.AreEqual(gameFrames[9].Score, 212);
            Assert.AreEqual(gameFrames[10].Score, 232);

            Assert.AreEqual(score, 232);
        }
コード例 #4
0
        public void varify_score_for_each_frame_of_the_game2()
        {
            inputData = new List <short[]>
            {
                new short[] { 1, 4 },
                new short[] { 4, 5 },
                new short[] { 6, 4 },
                new short[] { 5, 5 },
                new short[] { 10, 0 },
                new short[] { 0, 1 },
                new short[] { 7, 3 },
                new short[] { 6, 4 },
                new short[] { 10, 0 },
                new short[] { 2, 8, 6 }
            };

            game = CreateNewGame();
            var score      = game.FinalScore();
            var gameFrames = game.Frames;

            Assert.AreEqual(gameFrames[1].Score, 5);
            Assert.AreEqual(gameFrames[2].Score, 14);
            Assert.AreEqual(gameFrames[3].Score, 29);
            Assert.AreEqual(gameFrames[4].Score, 49);
            Assert.AreEqual(gameFrames[5].Score, 60);
            Assert.AreEqual(gameFrames[6].Score, 61);
            Assert.AreEqual(gameFrames[7].Score, 77);
            Assert.AreEqual(gameFrames[8].Score, 97);
            Assert.AreEqual(gameFrames[9].Score, 117);
            Assert.AreEqual(gameFrames[10].Score, 133);

            Assert.AreEqual(score, 133);
        }