コード例 #1
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
    def test_adds_new_frame_on_throw_when_active_frame_is_complete(self):
        active_frame = Frame(1)
        active_frame.rolls = [1,2]
        self.game.frames = [active_frame]
        self.game.active_frame = active_frame

        self.game.throw(5)
        new_frame = self.game.frames[-1]

        self.assertEqual(2, len(self.game.frames))
        self.assertEqual([5], new_frame.rolls)
        self.assertEqual(new_frame, self.game.active_frame)
コード例 #2
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
    def test_current_frame_returns_active_frame_plus_one_when_already_complete(self):
        active_frame = Frame(1)
        active_frame.rolls = [10]
        self.game.active_frame = active_frame

        self.assertEqual(2, self.game.current_frame)
コード例 #3
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
    def test_current_frame_returns_active_frame_number_when_not_complete(self):
        active_frame = Frame(1)
        active_frame.rolls = [5]
        self.game.active_frame = active_frame

        self.assertEqual(1, self.game.current_frame)
コード例 #4
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
 def test_game_does_not_have_more_throws_when_active_frame_is_tenth_and_is_complete(self):
     active_frame = Frame(10)
     active_frame.rolls = [10, 10, 10]
     self.game.active_frame = active_frame
     self.assertEqual(False, self.game.more_throws)
コード例 #5
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
 def test_is_not_complete_when_tenth_frame_and_only_one_ball(self):
     frame = Frame(10)
     frame.rolls = [1]
     self.assertEqual(False, frame.is_complete())
コード例 #6
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
 def test_is_not_complete_when_tenth_frame_and_two_balls_spare(self):
     frame = Frame(10)
     frame.rolls = [1, 9]
     self.assertEqual(False, frame.is_complete())
コード例 #7
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
 def test_is_complete_when_is_tenth_and_has_two_balls_without_strike_or_spare(self):
     frame = Frame(10)
     frame.rolls = [1, 2]
     self.assertEqual(True, frame.is_complete())
コード例 #8
0
ファイル: tests.py プロジェクト: imtapps/September-Kata
 def test_is_complete_when_is_tenth_frame_and_has_three_balls(self):
     frame = Frame(10)
     frame.rolls = [1, 9, 10]
     self.assertEqual(True, frame.is_complete())