public async Task <ItemModel> Handle(ObtenerItemRequest request, CancellationToken cancellationToken) { logger.LogInformation("Obteniendo item por termino {termino}", request.Termino); if (string.IsNullOrWhiteSpace(request.Termino)) { throw new BadRequestProjectException("Invalid search param"); } var dataModel = await service.ObtenerItemAsync(request.Termino); if (dataModel == null) { throw new NotFoundProjectException("Item not found"); } return(mapper.Map <ItemModel>(dataModel)); }
public void ObtenerItemsAsyncTest(string termino) { var result = service.ObtenerItemAsync(termino).Result; Assert.IsNotNull(result); }