Пример #1
0
 def setUp(self):
     self.gasstation = GasStation(100, 2)
Пример #2
0
class TestGasStation(unittest.TestCase):

    def setUp(self):
        self.gasstation = GasStation(100, 2)

    def it_verify_the_state_of_the_fuel_pump(self):
        self.gasstation.current_state |should| equal_to(100)

    def it_sell_fuel_by_liter(self):
        self.gasstation.sell_per_liter(30) |should| equal_to(60)
        self.gasstation.current_state |should| equal_to(70)
        self.gasstation.sell_per_liter(80) |should| equal_to('The gasstation only have 70 liters')
        self.gasstation.current_state |should| equal_to(70)

    def it_sell_fuel_by_ammount_value(self):
        self.gasstation.sell_per_value(60) |should| equal_to(30)
        self.gasstation.current_state |should| equal_to(70)
        self.gasstation.sell_per_value(1000) |should| equal_to('The gasstation only have 70 liters')

    def it_supply_gasstation(self):
        self.gasstation.sell_per_liter(30)
        self.gasstation.current_state |should| equal_to(70)
        self.gasstation.supply()
        self.gasstation.current_state |should| equal_to(100)

    def it_change_the_price_per_liter(self):
        self.gasstation.price_per_liter(3)
        self.gasstation.price |should| equal_to(3)