Exemplo n.º 1
0
    def test_vaccate_slot(self):
        # Arrange
        lh = LotHandler(2)
        firstCar = Car('KA-01-HH-1234', 'White')
        secondCar = Car('KA-01-BB-0001', 'Red')

        lh.FillSlot(firstCar, 1)
        lh.FillSlot(secondCar, 2)

        slotNumToVaccate = 1
        lh.VaccateSlot(slotNumToVaccate)
        self.assertTrue(slotNumToVaccate in lh.freeSlots)
        self.assertTrue(2 not in lh.freeSlots)
Exemplo n.º 2
0
    def test_vaccate_slot_not_present(self):
        # Arrange
        lh = LotHandler(2)
        firstCar = Car('KA-01-HH-1234', 'White')
        secondCar = Car('KA-01-BB-0001', 'Red')

        lh.FillSlot(firstCar, 1)
        lh.FillSlot(secondCar, 2)

        slotNumToVaccate = 3
        with self.assertRaises(ValueError) as ex:
            lh.VaccateSlot(slotNumToVaccate)
        self.assertEqual(ex.exception,
                         'No such Slot Number found in Parking lots')
Exemplo n.º 3
0
    def test_get_nearest_slot(self):
        # Arrange
        lh = LotHandler(4)
        car1 = Car('KA-01-HH-1234', 'White')
        car2 = Car('KA-04-HH-1231', 'Blue')
        car3 = Car('KA-04-HH-1231', 'Red')
        car4 = Car('KA-04-HH-1231', 'Blue')

        lh.FillSlot(car1, 1)
        lh.FillSlot(car2, 2)
        lh.FillSlot(car3, 3)
        lh.FillSlot(car4, 4)

        lh.VaccateSlot(2)
        lh.VaccateSlot(4)

        # Act
        val = lh.GetNearestSlot()
        # Assert
        self.assertEqual(val, 2)