Example #1
0
        public bool CallLift(int id, CallLiftDto request)
        {
            if (request.Floor > _options.FloorsMax || request.Floor < _options.FloorsMin)
            {
                return(false);
            }

            var lift = _liftRepository.GetById(id);

            RecordNewCall(id, request.Floor);
            _liftScheduler.ScheduleOperation(lift, request.Floor);

            return(true);
        }
        public void ScheduleOperation_FloorProvided_TravelledCorrectly(int floor, double timeout)
        {
            //Arrange
            var expectedFloor = floor;
            var timeoutSpan   = TimeSpan.FromSeconds(timeout);

            //Act
            _liftScheduler.ScheduleOperation(_lift, floor);
            Thread.Sleep(timeoutSpan);
            //Assert
            Assert.AreEqual(expectedFloor, _lift.CurrentFloor);
        }