예제 #1
0
        public void Passengers_NotArrivedAtDestination_False()
        {
            // Arrange
            var        floorList  = GetFloors();
            LiftConfig liftConfig = new LiftConfig();

            liftConfig.MaxFloors = 11;
            liftConfig.Floors    = GetFloors();
            liftConfig.Capacity  = 5;
            Lift.Lift lift = new Lift.Lift(liftConfig);

            // Act
            lift.Move(0);

            // Assert
            Assert.IsFalse(lift.GetFloors().Any(f => f.Passengers.Any(p => p.CurrentFloor != p.Destination)));
        }
예제 #2
0
        public void FloorHistory_Matches_False()
        {
            // Arrange
            var        floorList  = GetFloors();
            LiftConfig liftConfig = new LiftConfig();

            liftConfig.MaxFloors = 11;
            liftConfig.Floors    = GetFloors();
            liftConfig.Capacity  = 5;
            Lift.Lift lift = new Lift.Lift(liftConfig);

            // Act
            lift.Move(0);

            var floorHistory = string.Join("-", lift.GetFloorHistory());

            // Assert
            Assert.IsTrue(floorHistory != "1-0-5-6-7-8-7-6-5-4-3-2-4-0-10-9-4-3-2-1-9-10-2");
        }
예제 #3
0
        public void Mechanics_OverrodeDiraction_True()
        {
            // Arrange
            var        floorList  = GetFloors();
            LiftConfig liftConfig = new LiftConfig();

            liftConfig.MaxFloors = 11;
            liftConfig.Floors    = GetFloors();
            liftConfig.Capacity  = 5;
            Lift.Lift lift = new Lift.Lift(liftConfig);

            // Act
            lift.Move(0);

            // Assert
            var history = lift.GetFloorHistory();

            Assert.IsTrue(history[0] > history[1]);
            Assert.IsTrue(history[1] == 0);
        }