public async Task <PaisModel> Handle(ObtenerPaisRequest request, CancellationToken cancellationToken) { logger.LogInformation("Obteniendo pais por id {id}", request.Id); if (string.IsNullOrWhiteSpace(request.Id)) { throw new BadRequestProjectException("Invalid country id"); } var dataModel = await service.ObtenerPaisAsync(request.Id); if (dataModel == null) { throw new NotFoundProjectException("Country id not found"); } return(mapper.Map <PaisModel>(dataModel)); }
public void ObtenerPaisAsyncTest(string id) { var result = service.ObtenerPaisAsync(id).Result;; Assert.IsNotNull(result); }