def test01ElevatorStartsIdleWithDoorOpenOnFloorZero(self): elevatorController = ElevatorController() self.assertTrue(elevatorController.isIdle()) self.assertTrue(elevatorController.isCabinStopped()) self.assertTrue(elevatorController.isCabinDoorOpened()) self.assertEqual(0, elevatorController.cabinFloorNumber())
def test04CabinStopsAndStartsOpeningDoorWhenGetsToDestination(self): elevatorController = ElevatorController() elevatorController.goUpPushedFromFloor(1) elevatorController.cabinDoorClosed() elevatorController.cabinOnFloor(1) self.assertFalse(elevatorController.isIdle()) self.assertTrue(elevatorController.isWorking()) self.assertTrue(elevatorController.isCabinStopped()) self.assertFalse(elevatorController.isCabinMoving()) self.assertFalse(elevatorController.isCabinDoorOpened()) self.assertTrue(elevatorController.isCabinDoorOpening()) self.assertFalse(elevatorController.isCabinDoorClosing()) self.assertFalse(elevatorController.isCabinDoorClosed()) self.assertEquals(1, elevatorController.cabinFloorNumber())
def test05ElevatorGetsIdleWhenDoorGetOpened(self): elevatorController = ElevatorController() elevatorController.goUpPushedFromFloor(1) elevatorController.cabinDoorClosed() elevatorController.cabinOnFloor(1) elevatorController.cabinDoorOpened() self.assertTrue(elevatorController.isIdle()) self.assertFalse(elevatorController.isWorking()) self.assertTrue(elevatorController.isCabinStopped()) self.assertFalse(elevatorController.isCabinMoving()) self.assertTrue(elevatorController.isCabinDoorOpened()) self.assertFalse(elevatorController.isCabinDoorOpening()) self.assertFalse(elevatorController.isCabinDoorClosing()) self.assertFalse(elevatorController.isCabinDoorClosed()) self.assertEquals(1, elevatorController.cabinFloorNumber())