コード例 #1
0
        public async Task UpdateReservationTest()
        {
            // arrange
            Reservation reservation = await _target.Get(1);

            DateTime original = reservation.Bis;

            // act
            reservation.Bis = original.AddDays(2);
            await _target.Update(reservation);

            reservation = await _target.Get(1);

            // assert
            Xunit.Assert.Equal(original.AddDays(2), reservation.Bis);
        }
コード例 #2
0
        public async Task UpdateReservationTest()
        {
            // arrange
            Reservation reservation = await _target.Get(1);

            reservation.Von = new DateTime(2020, 10, 03);
            reservation.Bis = new DateTime(2020, 10, 18);

            // act
            await _target.Update(reservation);

            // assert
            reservation = await _target.Get(1);

            Assert.Equal(1, reservation.ReservationsNr);
            Assert.Equal(new DateTime(2020, 10, 03), reservation.Von);
            Assert.Equal(new DateTime(2020, 10, 18), reservation.Bis);
        }
コード例 #3
0
        public override async Task <ReservationDto> Get(ReservationRequest request, ServerCallContext context)
        {
            ReservationManager manager     = new ReservationManager();
            Reservation        reservation = await manager.Get(request.Id);

            if (reservation == null)
            {
                throw new RpcException(new Status(
                                           StatusCode.OutOfRange, "Id couldn't be found."
                                           ));
            }
            return(reservation.ConvertToDto());
        }
コード例 #4
0
        public async Task GetReservationWithCarAndCustomer()
        {
            // arrange & act
            Reservation = await _target.Get(1);

            // assert
            Assert.Equal(1, Reservation.CarId);
            Assert.NotNull(Reservation.Car);
            Assert.NotNull(Reservation.Customer);
        }
コード例 #5
0
        public override async Task <ReservationDto> GetReservation(GetReservationRequest request, ServerCallContext context)
        {
            ReservationDto response = new ReservationDto();

            try
            {
                Reservation data = await _reservationManager.Get(request.IdFilter);

                response = data.ConvertToDto();
            }
            catch (System.Exception e)
            {
                throw new RpcException(new Status(StatusCode.NotFound, e.Message));
            }

            return(await Task.FromResult(response));
        }
コード例 #6
0
 public override async Task <ReservationDto> Get(ReservationRequest request, ServerCallContext context)
 {
     return(await _reservationManager.Get(request.Id).ConvertToDto());
 }
コード例 #7
0
 public ReservationDto GetReservation(int id)
 {
     WriteActualMethod();
     return(_reservationManager.Get(id).ConvertToDto());
 }
コード例 #8
0
 private async Task UpdateContext()
 {
     _existingReservation = await _target.Get(1);
 }