Exemplo n.º 1
0
        public void testCloseDoorDoesNothingIfIdle()
        {
            ElevatorController elevatorController = new ElevatorController();

            elevatorController.closeCabinDoor();

            Assert.IsTrue(elevatorController.isIdle());
            Assert.IsTrue(elevatorController.isCabinStopped());
            Assert.IsTrue(elevatorController.isCabinDoorOpened());
        }
Exemplo n.º 2
0
        public void testCloseDoorDoesNothingWhenCabinIsMoving()
        {
            ElevatorController elevatorController = new ElevatorController();

            elevatorController.goUpPushedFromFloor(1);
            elevatorController.cabinDoorClosed();

            Assert.IsTrue(elevatorController.isWorking());
            Assert.IsTrue(elevatorController.isCabinMoving());
            Assert.IsTrue(elevatorController.isCabinDoorClosed());

            elevatorController.closeCabinDoor();

            Assert.IsTrue(elevatorController.isWorking());
            Assert.IsTrue(elevatorController.isCabinMoving());
            Assert.IsTrue(elevatorController.isCabinDoorClosed());
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        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());
        }