Exemple #1
0
        private Game GooiPerfectGame()
        {
            var game = new Game();
            for(var i=0; i<12;i++) {
                game.Gooi(10);
            }

            return game;
        }
Exemple #2
0
        private Game GooiVoorbeeldSpel()
        {
            var game = new Game();

            foreach(var score in VoorbeeldSpelScores) {
                game.Gooi(score);
            }

            return game;
        }
        public void NoThrowsGivesScoreForFrame1Is0()
        {
            var game = new Game();

            Assert.AreEqual(0, game.ScoreVoorFrame(1));
        }
        public void ThrowTwoConsecutive1PinsGivesScoreForFrame1Is2()
        {
            var game = new Game();

            game.Gooi(1);
            game.Gooi(1);

            Assert.AreEqual(2, game.ScoreVoorFrame(1));
        }
        public void NewGameShouldSetCurrentScore0()
        {
            var game = new Game();

            Assert.AreEqual(0, game.CurrentScore);
        }
        public void ThrowStrikeAnd1And1ShouldSetScoreForFrame1To12()
        {
            var game = new Game();

            game.Gooi(10);
            game.Gooi(1);
            game.Gooi(1);

            Assert.AreEqual(12, game.ScoreVoorFrame(1));
        }
        public void ThrowThreeConsecutive1PinsGivesScoreForFrame2Is3()
        {
            var game = new Game();

            game.Gooi(1);
            game.Gooi(1);
            game.Gooi(1);

            Assert.AreEqual(3, game.ScoreVoorFrame(2));
        }
        public void ThrowPerfectGameShouldSetScoreTo300()
        {
            var game = new Game();

            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(10);

            //            Assert.AreEqual(300, game.ScoreVoorFrame(10));
            Assert.AreEqual(300, game.CurrentScore);
        }
        public void ThrowSpareAnd1ShouldSetScoreForFrame1To11()
        {
            var game = new Game();

            game.Gooi(4);
            game.Gooi(6);
            game.Gooi(1);

            Assert.AreEqual(11, game.ScoreVoorFrame(1));
        }
        public void ThrowLessThanZeroShouldGiveException()
        {
            var game = new Game();

            game.Gooi(-1);
        }
        public void ThrowOnlySpareShouldSetScoreTo10()
        {
            var game = new Game();

            game.Gooi(4);
            game.Gooi(6);

            Assert.AreEqual(10, game.ScoreVoorFrame(1));
        }
        public void Throw2PinsShouldSetScore2()
        {
            var game = new Game();

            game.Gooi(2);

            Assert.AreEqual(2, game.CurrentScore);
        }
        public void Throw2ConsecutiveStrikesAnd1ShouldSetScoreForFrame1To21()
        {
            var game = new Game();

            game.Gooi(10);
            game.Gooi(10);
            game.Gooi(1);

            Assert.AreEqual(21, game.ScoreVoorFrame(1));
        }
        public void Throw2ConsecutiveRegularScoresShouldSum()
        {
            var game = new Game();

            game.Gooi(1);
            game.Gooi(1);

            Assert.AreEqual(2, game.CurrentScore);
        }
        public void Throw1PinsShouldSetScore1()
        {
            var game = new Game();

            game.Gooi(1);

            Assert.AreEqual(1, game.CurrentScore);
        }
        public void Throw1PinsGivesScoreForFrame1Is1()
        {
            var game = new Game();

            game.Gooi(1);

            Assert.AreEqual(1, game.ScoreVoorFrame(1));
        }