public void DeveriaProcessarAListaDoLegado() { // Arrange var funcionariolegadoRepo = new Mock <IRepository <FornecedorLegado> >(); funcionariolegadoRepo.Setup(c => c.List()) .Returns(ObterFornecedoresVariados(10, true)); RabbitMQConfigurations config = new RabbitMQConfigurations(); config.HostName = "172.28.112.1"; config.Port = 5672; config.UserName = "******"; config.Password = "******"; FactoryRabbitMQ _factory = new FactoryRabbitMQ(config); MessageBroker _broker = new MessageBroker(_factory); //List<FornecedorLegado> lista = funcionariolegadoRepo.List(); //var clienteService = new ClienteService(clienteRepo.Object, mediatr.Object); // Act //var clientes = clienteService.ObterTodosAtivos(); // Assert //clienteRepo.Verify(r => r.ObterTodos(), Times.Once); //Assert.True(clientes.Any()); //Assert.False(clientes.Count(c => !c.Ativo) > 0); ProcessamentoDoLegadoParaBroker processInt = new ProcessamentoDoLegadoParaBroker(funcionariolegadoRepo.Object, _broker); processInt.Process(); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { ProcessamentoDoLegadoParaBroker processInt = new ProcessamentoDoLegadoParaBroker(_repo, _broker); processInt.Process(); _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); await Task.Delay(1000, stoppingToken); } }