def test_should_change_quarter_after_time_elapses_over_quarter_time(self):
        # Arrange
        state = FootballSimulationGameState() \
                    .team1(FootballTeam('teama')) \
                    .team2(FootballTeam('teamb')) \
                    .quarter(1) \
                    .time(40000)

        # Act
        state2 = simulate_once(state)

        # Assert
        self.assertTrue(QuarterChangedEvent in map(lambda e: type(e), state2.get_events()))
    def test_should_simulate_play_if_time_elapses(self):
        # Arrange
        state = FootballSimulationGameState() \
                    .team1(FootballTeam('teama')) \
                    .team2(FootballTeam('teamb')) \
                    .possession_index(0) \
                    .quarter(1) \
                    .time(1)

        # Act
        state2 = simulate_once(state)

        # Assert
        self.assertIsInstance(state2.get_events()[-1], NormalPlayOutcome)
Beispiel #3
0
    def test_should_not_do_kickoff_at_quarter1_time1(self):
        # Arrange
        state = FootballSimulationGameState() \
                    .team1(FootballTeam('teama')) \
                    .team2(FootballTeam('teamb')) \
                    .possession_index(0) \
                    .quarter(1) \
                    .time(1)

        # Act
        state2 = simulate_once(state)

        # Assert
        self.assertFalse(KickOffPlayOutcome in map(lambda e: type(e), state2.get_events()))