Ejemplo n.º 1
0
        public async Task PickUpCarAsync_Valid_UpdatesReservationState()
        {
            //Arrange
            var mockedReservationRepository = GetReservationRepositoryWithReservation(50, ReservationState.Booked);
            var bl = new BLReservation(mockedReservationRepository, null, null, mockedUnitOfWork);

            //Act
            var reservation = await bl.PickUpCarAsync(50);

            //Assert
            Assert.Equal(ReservationState.PickedUp, reservation.State);
        }
Ejemplo n.º 2
0
        public async Task PickUpCarAsync_Invalid_ThrowsCustomException(long reservationIdToPickup, long reservationIdInDb, ReservationState previousState, ErrorCode errorCode)
        {
            //Arrange
            var mockedReservationRepository = GetReservationRepositoryWithReservation(reservationIdInDb, previousState);
            var bl = new BLReservation(mockedReservationRepository, null, null, mockedUnitOfWork);

            //Act
            async Task act() => await bl.PickUpCarAsync(reservationIdToPickup);

            //Assert
            var exception = await Assert.ThrowsAsync <CustomException>(act);

            Assert.Equal(errorCode, exception.code);
        }