Exemplo n.º 1
0
        public async Task Request_TryMoveToSamePosition_SamePositionException()
        {
            //arrange
            IVehicle elevator = ElevatorBuild.Build(currentFloor: 5, minFloor: 1, maxFloor: 10);

            //act
            await elevator.RequestAsync(1, 1);
        }
Exemplo n.º 2
0
        public async Task Request_10FloorsSingleRequestMoveToDown_CurrentShouldBeTheEndSetPosition()
        {
            //arrange
            IVehicle elevator            = ElevatorBuild.Build(currentFloor: 5, minFloor: 1, maxFloor: 10);
            var      elevatorNewPosition = 1;

            //act
            await elevator.RequestAsync(10, elevatorNewPosition);

            //assert
            Assert.AreEqual(elevatorNewPosition, elevator.CurrentPosition);
        }
Exemplo n.º 3
0
        public async Task Request_10FloorsMultiplesRequestMoveUp_CurrentShouldBeTheEndSetPosition()
        {
            //arrange
            IVehicle elevator            = ElevatorBuild.Build(currentFloor: 5, minFloor: 1, maxFloor: 10);
            var      elevatorEndPosition = 8;

            //act
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            elevator.RequestAsync(1, 4);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            await elevator.RequestAsync(7, elevatorEndPosition);

            //assert
            Assert.AreEqual(elevatorEndPosition, elevator.CurrentPosition);
        }