public void testCabinHasToStopOnFloorsOnItsWayNoMatterHowTheyWellCalled() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(2); elevatorController.cabinDoorClosed(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinOnFloor(1); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); }
public void testRequestToGoUpAreEnqueueWhenRequestedWhenCabinIsMoving() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); elevatorController.goUpPushedFromFloor(2); elevatorController.cabinDoorOpened(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinWaitingForPeople()); Assert.IsTrue(elevatorController.isCabinDoorOpened()); }
public void testCabinDoorStartClosingAfterWaitingForPeople() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); elevatorController.goUpPushedFromFloor(2); elevatorController.cabinDoorOpened(); elevatorController.waitForPeopleTimedOut(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorClosing()); }
public void testElevatorCompletesAllTheRequests() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.goUpPushedFromFloor(2); elevatorController.cabinOnFloor(1); elevatorController.cabinDoorOpened(); elevatorController.waitForPeopleTimedOut(); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(2); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); }
public void testStopsWaitingForPeopleIfCloseDoorIsPressed() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); elevatorController.goUpPushedFromFloor(2); elevatorController.cabinDoorOpened(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinWaitingForPeople()); Assert.IsTrue(elevatorController.isCabinDoorOpened()); elevatorController.closeCabinDoor(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorClosing()); }
public void testDoorMustBeOpenedWhenCabinIsStoppedAndClosingDoors() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorClosing()); elevatorController.openCabinDoor(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); }
public void testElevatorHasToEnterEmergencyIfDoorClosedSensorTurnsOnWhenClosed() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); try { elevatorController.cabinDoorClosed(); Assert.Fail(); } catch (ElevatorEmergency elevatorEmergency) { Assert.IsTrue(elevatorEmergency.Message == "Sensor de puerta desincronizado"); } }
public void testElevatorHasToEnterEmergencyIfJumpsFloors() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(3); elevatorController.cabinDoorClosed(); try { elevatorController.cabinOnFloor(3); Assert.Fail(); } catch (ElevatorEmergency elevatorEmergency) { Assert.IsTrue(elevatorEmergency.Message == "Sensor de cabina desincronizado"); } }
public void testCanNotOpenDoorWhenCabinIsMoving() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinMoving()); Assert.IsTrue(elevatorController.isCabinDoorClosed()); elevatorController.openCabinDoor(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinMoving()); Assert.IsTrue(elevatorController.isCabinDoorClosed()); }
public void testCabinDoorStartsClosingWhenElevatorGetsCalled() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); Assert.IsFalse(elevatorController.isIdle()); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsFalse(elevatorController.isCabinMoving()); Assert.IsFalse(elevatorController.isCabinDoorOpened()); Assert.IsFalse(elevatorController.isCabinDoorOpening()); Assert.IsTrue(elevatorController.isCabinDoorClosing()); Assert.IsFalse(elevatorController.isCabinDoorClosed()); }
public void testDoorKeepsOpeneingWhenItIsOpeneing() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); elevatorController.openCabinDoor(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); }
public void testCloseDoorDoesNothingWhenOpeningTheDoorToWaitForPeople() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); elevatorController.closeCabinDoor(); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); }
public void testCabinStopsAndStartsOpeningDoorWhenGetsToDestination() { ElevatorController elevatorController = new ElevatorController(); elevatorController.goUpPushedFromFloor(1); elevatorController.cabinDoorClosed(); elevatorController.cabinOnFloor(1); Assert.IsFalse(elevatorController.isIdle()); Assert.IsTrue(elevatorController.isWorking()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsFalse(elevatorController.isCabinMoving()); Assert.IsFalse(elevatorController.isCabinDoorOpened()); Assert.IsTrue(elevatorController.isCabinDoorOpening()); Assert.IsFalse(elevatorController.isCabinDoorClosing()); Assert.IsFalse(elevatorController.isCabinDoorClosed()); Assert.AreEqual(1, elevatorController.cabinFloorNumber()); }