public async Task InsertReservationTest() { // arrange Timestamp von = Timestamp.FromDateTime(new DateTime(2021, 07, 15, 0, 0, 0, DateTimeKind.Utc)); Timestamp bis = Timestamp.FromDateTime(new DateTime(2021, 07, 17, 0, 0, 0, DateTimeKind.Utc)); KundeDto kundeDto = _kundeClient.Get(new KundeRequest { Id = 4 }); AutoDto autoDto = _autoClient.Get(new AutoRequest { Id = 4 }); ReservationDto reservation = new ReservationDto(); reservation.Von = von; reservation.Bis = bis; reservation.Kunde = kundeDto; reservation.Auto = autoDto; // act ReservationDto reservationDto = _target.Insert(reservation); ReservationDto reservation1 = _target.Get(new ReservationRequest { Id = reservationDto.ReservationsNr }); // assert CompareReservationDtos(reservation1, reservationDto.ReservationsNr, von, bis, kundeDto, autoDto); }
public async Task InsertReservationWithInvalidDateRangeTest() { AutoDto autoDto = await _autoClient.GetByIdAsync(new GetAutoByIdRequest { Id = 1 }); KundeDto kundeDto = await _kundeClient.GetByIdAsync(new GetKundeByIdRequest { Id = 1 }); ReservationDto reservationDto = new ReservationDto { Von = new DateTime(1808, 1, 11, 0, 0, 0, DateTimeKind.Utc).ToTimestamp(), Bis = new DateTime(1807, 1, 12, 0, 0, 0, DateTimeKind.Utc).ToTimestamp(), RowVersion = Google.Protobuf.ByteString.CopyFromUtf8(""), Auto = autoDto, Kunde = kundeDto }; Assert.Throws <RpcException>(() => _target.Insert(reservationDto)); }
public async Task InsertReservationTest() { // arrange KundeDto client = _kundeClient.Get(new KundeRequest { Id = 1 }); AutoDto car = _autoClient.Get(new AutoRequest { Id = 1 }); Timestamp von = Timestamp.FromDateTime(new DateTime(2019, 12, 23, 0, 0, 0, DateTimeKind.Utc)); Timestamp bis = Timestamp.FromDateTime(new DateTime(2019, 12, 26, 0, 0, 0, DateTimeKind.Utc)); // act ReservationDto reservation = new ReservationDto { Auto = car, Kunde = client, Von = von, Bis = bis }; ReservationDto result = _target.Insert(reservation); // assert Assert.NotNull(result); }