public async Task GetKundeByIdTest() { const int id = 1; var request = new GetKundeRequest { Id = id }; var response = await _target.GetKundeByIdAsync(request); Assert.Equal(id, response.Id); Assert.Equal("Nass", response.Nachname); Assert.Equal("Anna", response.Vorname); }
public async Task GetKundeByIdTest() { const int id = 1; var request = new GetKundeRequest { IdFilter = id }; var response = await _target.GetKundeAsync(request); Assert.Equal(id, response.Id); Assert.Equal("Nass", response.Nachname); Assert.Equal("Anna", response.Vorname); Assert.Equal(new DateTime(1981, 05, 05), response.Geburtsdatum.ToDateTime()); }
public override async Task <KundeDto> GetKunde(GetKundeRequest request, ServerCallContext context) { KundeDto 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."))); }
public async Task GetKundeByIdWithIllegalIdTest() { const int invalidId = 100; var request = new GetKundeRequest { Id = invalidId }; try { await _target.GetKundeByIdAsync(request); } catch (RpcException e) { Assert.Equal(StatusCode.NotFound, e.StatusCode); } }
public override async Task <KundeDto> GetKundeById(GetKundeRequest request, ServerCallContext context) { KundeDto response = await kundeManager.GetKundeById(request.Id).ConvertToDto(); return(response ?? throw new RpcException(new Status(StatusCode.NotFound, "ID is invalid."))); }