public void testDoorKeepsOpenedWhenOpeningIsRequested() { ElevatorController elevatorController = new ElevatorController(); Assert.IsTrue(elevatorController.isCabinDoorOpened()); elevatorController.openCabinDoor(); Assert.IsTrue(elevatorController.isCabinDoorOpened()); }
public void testElevatorStartsIdleWithDoorOpenOnFloorZero() { ElevatorController elevatorController = new ElevatorController(); Assert.IsTrue(elevatorController.isIdle()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpened()); Assert.AreEqual(0, elevatorController.cabinFloorNumber()); }
public void testCloseDoorDoesNothingIfIdle() { ElevatorController elevatorController = new ElevatorController(); elevatorController.closeCabinDoor(); Assert.IsTrue(elevatorController.isIdle()); Assert.IsTrue(elevatorController.isCabinStopped()); Assert.IsTrue(elevatorController.isCabinDoorOpened()); }
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 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 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 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()); }