public void When_transaction_events_disabled_harvest_is_not_scheduled() { _configurationAutoResponder.Dispose(); _transactionEventAggregator.Dispose(); var configuration = Mock.Create <IConfiguration>(); Mock.Arrange(() => configuration.TransactionEventsEnabled).Returns(false); _configurationAutoResponder = new ConfigurationAutoResponder(configuration); _transactionEventAggregator = new TransactionEventAggregator(_dataTransportService, _scheduler, _processStatic, _agentHealthReporter); EventBus <AgentConnectedEvent> .Publish(new AgentConnectedEvent()); Mock.Assert(() => _scheduler.StopExecuting(null, null), Args.Ignore()); }
public void SetUp() { var configuration = GetDefaultConfiguration(); Mock.Arrange(() => configuration.CollectorSendDataOnExit).Returns(true); Mock.Arrange(() => configuration.CollectorSendDataOnExitThreshold).Returns(0); Mock.Arrange(() => configuration.TransactionEventsHarvestCycle).Returns(ConfiguredHarvestCycle); _configurationAutoResponder = new ConfigurationAutoResponder(configuration); _dataTransportService = Mock.Create <IDataTransportService>(); _agentHealthReporter = Mock.Create <IAgentHealthReporter>(); _processStatic = Mock.Create <IProcessStatic>(); _scheduler = Mock.Create <IScheduler>(); Mock.Arrange(() => _scheduler.ExecuteEvery(Arg.IsAny <Action>(), Arg.IsAny <TimeSpan>(), Arg.IsAny <TimeSpan?>())) .DoInstead <Action, TimeSpan, TimeSpan?>((action, harvestCycle, __) => { _harvestAction = action; _harvestCycle = harvestCycle; }); _transactionEventAggregator = new TransactionEventAggregator(_dataTransportService, _scheduler, _processStatic, _agentHealthReporter); EventBus <AgentConnectedEvent> .Publish(new AgentConnectedEvent()); }