public async Task ScenarioOkay01Test() { // arrange //| ---Date 1--- | // | ---Date 2--- | Reservation = new Reservation { CarId = 1, From = new DateTime(Year, 01, 20), To = new DateTime(Year, 01, 30) }; // act & assert Assert.True(await _target.AvailabilityCheck(Reservation)); }
public override async Task <CheckResponse> AvailabilityCheck(ReservationDto request, ServerCallContext context) { Reservation reservation = request.ConvertToEntity(); CheckResponse response = new CheckResponse(); response.IsValid = await _reservationManager.AvailabilityCheck(reservation); return(response); }
public override async Task <IsAvailableResponse> CheckAvailability(ReservationDto request, ServerCallContext context) { var reservation = request.ConvertToEntity(); try { await reservationenManager.AvailabilityCheck(reservation); } catch (AutoUnavailableException) { return(new IsAvailableResponse { IsAvailable = false }); } return(new IsAvailableResponse { IsAvailable = true }); }