public override async Task <AutoDto> InsertAuto(AutoDto request, ServerCallContext context) { try { var entity = request.ConvertToEntity(); var response = await _manager.AddEntity(entity); return(response.ConvertToDto()); } catch (Exception) { throw new RpcException(new Status(StatusCode.Internal, "Internal error occured.")); } }
public async Task addAutoTest() { // arrange Auto auto = new LuxusklasseAuto { Marke = "Mercedes", Tagestarif = 200 }; // act await _target.AddEntity <Auto>(auto); // assert Auto testAuto = _target.GetByPrimaryKey(5).Result; Assert.True("Mercedes" == testAuto.Marke, "It should be Mercedes and not: " + testAuto.Marke); }