Пример #1
0
 public void SetFramesCanBeUsedToAddDataToFrames()
 {
     Game g = new Game();
     g.SetFrames("-123-");
     Assert.AreEqual(1, g.GetFrameScore(0));
     Assert.AreEqual(5, g.GetFrameScore(1));
 }
Пример #2
0
        public void Score_TwoStrikes_AndRestOne()
        {
            Game game = new Game();
            game.Roll(10);
            game.Roll(10);
            for (int i = 1; i <= 16; i++)
                game.Roll(1);

            Assert.That(game.Score, Is.EqualTo(49));
        }
Пример #3
0
 public void Score_PerfectGame_ResultIs300()
 {
     Game game = new Game();
     for (int i = 1; i <= 12; i++)
         game.Roll(10);
     Assert.That(game.Frames.Count,Is.EqualTo(10));
     Assert.That(game.Score, Is.EqualTo(300));
 }
Пример #4
0
        public void Score_Game_With_Spares_Only()
        {
            Game game = new Game();

            for (int i = 1; i <= 21; i++)
                game.Roll(5);

            Assert.That(game.Score, Is.EqualTo(150));
        }
Пример #5
0
        public void Score_Game_With_Nines_And_Miss_Only()
        {
            Game game = new Game();

            for (int i = 1; i <= 10; i++)
            {
                game.Roll(9);
                game.Roll(0);
            }

            Assert.That(game.Score, Is.EqualTo(90));
        }
Пример #6
0
 public static void Main(string[] args)
 {
     var game = new Game();
     game.Roll(12);
 }
Пример #7
0
 protected void SetUp()
 {
     game = new BowlingKata.Game();
 }
Пример #8
0
 public void ConstructorCreatesEmptyGame()
 {
     Game g = new Game(string.Empty);
     Assert.AreEqual(10, g.FrameCount);
 }
Пример #9
0
        static void Main(string[] args)
        {
            Game myGame = new Game();
            // Frame 1
            myGame.roll(6);
            myGame.roll(1);
            // Frame 2
            myGame.roll(9);
            myGame.roll(0);
            // Frame 3
            myGame.roll(8);
            myGame.roll(2);
            // Frame 4
            myGame.roll(5);
            myGame.roll(5);
            // Frame 5
            myGame.roll(8);
            myGame.roll(0);
            // Frame 6
            myGame.roll(6);
            myGame.roll(2);
            // Frame 7
            myGame.roll(9);
            myGame.roll(1);
            // Frame 8
            myGame.roll(7);
            myGame.roll(2);
            // Frame 9
            myGame.roll(8);
            myGame.roll(2);
            // Frame 10
            myGame.roll(9);
            myGame.roll(1);
            myGame.roll(7);

            if (myGame.score() == 127)
                Console.WriteLine("Winnrar");
            else
                Console.WriteLine("Loser.");
        }
Пример #10
0
 public void GetScoreSubtractsFirstRollInCaseOfSpare()
 {
     Game g = new Game("5/5/5/5/5/5/5/5/5/5/5");
     Assert.AreEqual(150, g.GetScore());
 }
Пример #11
0
 public void GetScoreDoesLookAheadToLastFrame()
 {
     Game g = new Game("XXXXXXXXXXXX");
     Assert.AreEqual(300, g.GetScore());
 }
Пример #12
0
 public void GetFrameScoreReturnsCorrectScores(string game, int expectedScore)
 {
     Game g = new Game(game);
     Assert.AreEqual(expectedScore, g.GetFrameScore(0));
 }
Пример #13
0
 public void ConstructorCreatesNonEmptyGame()
 {
     Game g = new Game("-1-2");
     Assert.AreEqual(10, g.FrameCount);
     Assert.AreEqual(1, g.GetFrameScore(0));
 }
Пример #14
0
        public void Score_UserGetsNoPoint_ReturnsZero()
        {
            Game game = new Game();

            for (int i = 1; i <= 20; i++)
                game.Roll(0);

            Assert.That(game.Score, Is.EqualTo(0));
        }
 public DescribeBowlingGame()
 {
     game = new Game();
 }
Пример #16
0
        public void Score_UserGetsPinsWithOnlyOnePin_ReturnsTwenty()
        {
            Game game = new Game();

            for (int i = 1; i <= 20; i++)
                game.Roll(1);

            Assert.That(game.Score, Is.EqualTo(20));
        }
Пример #17
0
 public void SetUp()
 {
     _game = new Game();
 }