Beispiel #1
0
 def test_refuel__when_fuel_more_than_capacity__should_be_equal(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.refuel(15)
     self.assertEqual(self.fuel_capacity, car_manager.fuel_amount)
Beispiel #2
0
 def test_refuel__when_fuel_negative_and_has_capacity__should_raise_exception(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     with self.assertRaises(Exception):
         car_manager.refuel(-5)
Beispiel #3
0
 def test_refuel__when_fuel_less_than_capacity__should_add(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.fuel_amount = 3
     car_manager.refuel(5)
     self.assertEqual(8, car_manager.fuel_amount)
Beispiel #4
0
 def test_refuel__when_fuel_positive_and_has_capacity__should_work(self):
     car_manager = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity)
     car_manager.refuel(5)
     self.assertEqual(5, car_manager.fuel_amount)