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); }
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); }
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()); }
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); }
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)); }
public override async Task <ReservationDto> Get(ReservationRequest request, ServerCallContext context) { return(await _reservationManager.Get(request.Id).ConvertToDto()); }
public ReservationDto GetReservation(int id) { WriteActualMethod(); return(_reservationManager.Get(id).ConvertToDto()); }
private async Task UpdateContext() { _existingReservation = await _target.Get(1); }