public void When_error_traces_disabled_harvest_is_not_scheduled() { _configurationAutoResponder.Dispose(); _errorTraceAggregator.Dispose(); var configuration = Mock.Create <IConfiguration>(); Mock.Arrange(() => configuration.ErrorCollectorEnabled).Returns(false); _configurationAutoResponder = new ConfigurationAutoResponder(configuration); _errorTraceAggregator = new ErrorTraceAggregator(_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); _configurationAutoResponder = new ConfigurationAutoResponder(configuration); _dataTransportService = Mock.Create <IDataTransportService>(); _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; }); _processStatic = Mock.Create <IProcessStatic>(); _agentHealthReporter = Mock.Create <IAgentHealthReporter>(); _errorTraceAggregator = new ErrorTraceAggregator(_dataTransportService, _scheduler, _processStatic, _agentHealthReporter); EventBus <AgentConnectedEvent> .Publish(new AgentConnectedEvent()); }