public void FindAutoByPrimaryKey()
        {
            // arrange
            // act
            Auto auto = _target.GetByPrimaryKey(1).Result;

            // assert
            Assert.True("Fiat Punto" == auto.Marke, "It should be Fiat Punto and not: " + auto.Marke);
        }
Ejemplo n.º 2
0
        public override async Task <AutoDto> GetAuto(GetAutoRequest request, ServerCallContext context)
        {
            AutoDto 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.")));
        }