Example #1
0
 public InvestimentoController(IInvestimentoService investimentoService,
                               IRedisCache redisCache,
                               IDistributedCache cache)
 {
     _investimentoService = investimentoService;
     _redisCache          = redisCache;
     _cache = cache;
 }
Example #2
0
 public InvestimentosController(IInvestimentoService service,
                                ITesouroDiretoService tesouroService,
                                IRendaFixaService rendaFixaService,
                                IFundoService fundoService,
                                ILogger <InvestimentosController> logger)
 {
     _service          = service;
     _tesouroService   = tesouroService;
     _rendaFixaService = rendaFixaService;
     _fundoService     = fundoService;
     _logger           = logger;
 }
        public void Setup()
        {
            _fundoServices                  = new Mock <IInvestimentoService>();
            _tesouroDiretoService           = new Mock <IInvestimentoService>();
            _lciService                     = new Mock <IInvestimentoService>();
            _portifolioInvestimentosFactory = new Mock <IPortifolioInvestimentosFactory>();
            _logger  = new Mock <ILogger <PortifolioInvestimentosService> >();
            _fixture = new Fixture();

            var investimentoServices = new IInvestimentoService[] { _fundoServices.Object, _tesouroDiretoService.Object, _lciService.Object };

            _portifolioInvestimentosService = new PortifolioInvestimentosService(investimentoServices, _portifolioInvestimentosFactory.Object, _logger.Object);
        }
Example #4
0
        private async Task GetInvestimentosService(string idCliente, List <Investimento> investimentosAgregados, IInvestimentoService service)
        {
            var tipoService = service.GetType().ToString();

            try
            {
                _logger.LogInformation($"Iniciando chamada ao serviço {tipoService} para o cliente {idCliente}");
                var investimentos = await service.GetInvestimentosByIdCliente(idCliente);

                _logger.LogInformation($"Chamada ao serviço {tipoService} finalizada com sucesso para o cliente {idCliente}");

                investimentosAgregados.AddRange(investimentos);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Erro ao realizar chamada ao serviço {tipoService}");
            }
        }
 public InvestimentosController(IInvestimentoService _service, IMemoryCache _memoryCache)
 {
     service     = _service;
     memoryCache = _memoryCache;
 }