示例#1
0
        public async Task UpdateReservationTest()
        {
            // arrange
            int         autoID     = 4;
            int         primaryKey = 1;
            Reservation res        = await _target.GetByPrimaryKey(primaryKey);

            // act
            res.AutoId = autoID;
            await _target.UpdateEntity(res);

            // assert
            Reservation changedReservation = await _target.GetByPrimaryKey(primaryKey);

            Assert.True(changedReservation.AutoId == autoID);
        }
示例#2
0
        public override async Task <ReservationDto> GetReservationById(GetReservationRequest request,
                                                                       ServerCallContext context)
        {
            ReservationDto response;

            try
            {
                response = await _manager.GetByPrimaryKey(request.IdFilter).ConvertToDto();
            }
            catch (Exception)
            {
                throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
            }

            return(response ?? throw new RpcException(new Status(StatusCode.NotFound, "ID is invalid.")));
        }