コード例 #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
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
        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
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
 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
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
        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
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
        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
ファイル: Program.cs プロジェクト: cschrammel/BowlingKata
 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
ファイル: Program.cs プロジェクト: calebthompson/School
        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
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
        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));
        }
コード例 #15
0
 public DescribeBowlingGame()
 {
     game = new Game();
 }
コード例 #16
0
ファイル: Class1.cs プロジェクト: LuizS/KataBowling
        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();
 }