예제 #1
0
        public void NotRecordRepeatedConsecutiveFloors()
        {
            var elevator = new Elevator();

            elevator.CallFrom(2);
            elevator.GoTo(0);
            elevator.CallFrom(0);
            elevator.GoTo(1);
            elevator.Operate();

            Assert.AreEqual(new List <int>()
            {
                2, 0, 1
            }, elevator.VisitedFloors);
        }
예제 #2
0
        public void OpenTheDoorsInOrderWhenMovingInOneDirection()
        {
            var elevator = new Elevator();

            elevator.CallFrom(-1);
            elevator.GoTo(2);
            elevator.CallFrom(3);
            elevator.GoTo(6);
            elevator.Operate();

            Assert.AreEqual(new List <int>()
            {
                -1, 2, 3, 6
            }, elevator.VisitedFloors);
        }
예제 #3
0
        public void GoToTheRequestingFloorsAndThenToTheRequestedFloorsInOrderWhenOperates()
        {
            var elevator = new Elevator();

            elevator.CallFrom(0);
            elevator.GoTo(3);
            elevator.CallFrom(2);
            elevator.GoTo(4);
            elevator.Operate();

            Assert.AreEqual(new List <int>()
            {
                0, 2, 3, 4
            }, elevator.VisitedFloors);
        }
예제 #4
0
        public void RecordTheRequestingFloors()
        {
            var elevator = new Elevator();

            elevator.CallFrom(2);
            elevator.Operate();

            Assert.AreEqual(new[] { 2 }, elevator.VisitedFloors);
        }
 private void AnUserGoesFromTo(int initialFloor, int destinationFloor)
 {
     elevator.CallFrom(initialFloor);
     elevator.GoTo(destinationFloor);
 }