示例#1
0
class checkOver(unittest.TestCase):
    """ Test cases of checkOver """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]
        
        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns
        
    def notOver(self):
        """ Test that the the effects are not called when the effect is not over """
        self.delegate.turnOn = 1
        messages = self.delegate.checkOver(None, None)
        assert messages == [], "If the effect is not over, the effects should not be called"
        
    def over(self):
        """ Test that the the effects are called when the effect is over """
        self.delegate.turnOn = 0
        messages = self.delegate.checkOver(None, None)
        assert messages == [self.effect.message], "Should get the messages from the effects"
示例#2
0
class checkOver(unittest.TestCase):
    """ Test cases of checkOver """
    def setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]

        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns

    def notOver(self):
        """ Test that the the effects are not called when the effect is not over """
        self.delegate.turnOn = 1
        messages = self.delegate.checkOver(None, None)
        assert messages == [], "If the effect is not over, the effects should not be called"

    def over(self):
        """ Test that the the effects are called when the effect is over """
        self.delegate.turnOn = 0
        messages = self.delegate.checkOver(None, None)
        assert messages == [self.effect.message
                            ], "Should get the messages from the effects"