Example #1
0
 def  setUp(self):
     """ Build the Cost Calculator for the test """
     self.modifierCosts = [1, 2, 3, 4, 5]
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
     
     self.costCalculatorWithCostMods = FixedCost(self.cost)
     [self.costCalculatorWithCostMods.addCostModifier(FixedCost(cost)) for cost in self.modifierCosts]
Example #2
0
class addCostModifier(unittest.TestCase):
    """ Test cases of addCostModifier """
    
    def  setUp(self):
        """ Build the Cost Calculator and Modifier for the test """
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        
    def added(self):
        """ Test that the Cost Modifier is added """
        costMod = FixedCost(1)
        self.costCalculator.addCostModifier(costMod)
        self.assertIn(costMod, self.costCalculator.costModifiers, "The Cost Mod should be added to the Cost Mods of the Fixed Cost Calculator")
Example #3
0
def BuildCard(name="Test", cardType=None, **kwargs):
    """ Build a Card for testing purposes """
    return Card(name,
                cardType,
                costCalculator=FixedCost(1),
                vpCalculator=FixedPoints(1),
                **kwargs)
Example #4
0
class calculateCost(unittest.TestCase):
    """ Test cases of calculateCost """
    
    def  setUp(self):
        """ Build the Cost Calculator for the test """
        self.modifierCosts = [1, 2, 3, 4, 5]
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        
        self.costCalculatorWithCostMods = FixedCost(self.cost)
        [self.costCalculatorWithCostMods.addCostModifier(FixedCost(cost)) for cost in self.modifierCosts]
        
        
    def basicCost(self):
        """ Test that the basic cost is returned proeprly """
        cost = self.costCalculator.calculateCost()
        self.assertEquals(cost, self.cost, "The Cost should be the cost of the Fixed Cost Calculator")
        
    def withCostMods(self):
        """ Test that the cost is returned proeprly with cost mods """
        cost = self.costCalculatorWithCostMods.calculateCost()
        self.assertEquals(cost, sum([self.cost] + self.modifierCosts), "The Cost should be the cost of the Fixed Cost Calculator and all of its Cost Mods")
Example #5
0
class removeCostModifier(unittest.TestCase):
    """ Test cases of removeCostModifier """
    
    def  setUp(self):
        """ Build the *** for the test """
        self.cost = 10
        self.costCalculator = FixedCost(self.cost)
        self.costMod = FixedCost(1)
        self.costCalculator.addCostModifier(self.costMod)
        
    def removed(self):
        """ Test that the Cost Mod is properly removed when it is added """
        self.costCalculator.removeCostModifier(self.costMod)
        self.assertNotIn(self.costMod, self.costCalculator.costModifiers, "The Cost Mod should be remvoed from the Cost Mods of the Fixed Cost Calculator")
        
    def notInCostMods(self):
        """ Test that no error is thrown when attempting to remove a Cost Mod that has not been added """
        costMod = FixedCost(1)
        self.costCalculator.removeCostModifier(costMod)
Example #6
0
 def notInCostMods(self):
     """ Test that no error is thrown when attempting to remove a Cost Mod that has not been added """
     costMod = FixedCost(1)
     self.costCalculator.removeCostModifier(costMod)
Example #7
0
 def  setUp(self):
     """ Build the *** for the test """
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
     self.costMod = FixedCost(1)
     self.costCalculator.addCostModifier(self.costMod)
Example #8
0
 def added(self):
     """ Test that the Cost Modifier is added """
     costMod = FixedCost(1)
     self.costCalculator.addCostModifier(costMod)
     self.assertIn(costMod, self.costCalculator.costModifiers, "The Cost Mod should be added to the Cost Mods of the Fixed Cost Calculator")
Example #9
0
 def  setUp(self):
     """ Build the Cost Calculator and Modifier for the test """
     self.cost = 10
     self.costCalculator = FixedCost(self.cost)
Example #10
0
def loadCost(data):
    """ Load the Cost """
    return FixedCost(data["cost"])