/// <summary>
 /// Initializes a new instance of the <see cref="AgentTestRunner"/> class.
 /// </summary>
 /// <param name="projects">The storage.</param>
 /// <param name="runnerCache">The cash.</param>
 /// <param name="initializer">The initializer.</param>
 /// <param name="configurationOperator">The configuration operator.</param>
 /// <param name="exceptionCatcher">The exception catcher.</param>
 /// <param name="bootstrapperParameters">The bootstrapper parameters.</param>
 /// <param name="log">The log.</param>
 public AgentTestRunner(
     IProjectsStorage projects,
     INativeRunnerCache runnerCache,
     ITestSystemInitializer initializer,
     IDistributedConfigurationOperator configurationOperator,
     ExceptionCatcher exceptionCatcher,
     BootstrapperParameters bootstrapperParameters,
     ILog log)
 {
     this.projects = projects;
     this.runnerCache = runnerCache;
     this.initializer = initializer;
     this.configurationOperator = configurationOperator;
     this.exceptionCatcher = exceptionCatcher;
     this.log = log;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerTestRunner"/> class.
        /// </summary>
        /// <param name="agents">The agents.</param>
        /// <param name="tests">The tests.</param>
        /// <param name="requests">The requests.</param>
        /// <param name="projects">The projects.</param>
        /// <param name="results">The results.</param>
        /// <param name="log">The log.</param>
        /// <param name="testsRetriever">The tests parser.</param>
        /// <param name="configurationOperator">The configuration reader.</param>
        /// <param name="scheduler">The scheduler.</param>
        /// <param name="reprocessor">The reprocessor.</param>
        /// <param name="exceptionCatcher">The exception catcher.</param>
        /// <param name="connectionProvider">The connection provider.</param>
        public ServerTestRunner(AgentsCollection agents,
                                TestUnitsCollection tests,
                                IRequestsStorage requests,
                                IProjectsStorage projects,
                                IResultsStorage results,
                                ILog log,
                                ITestsRetriever testsRetriever,
                                IDistributedConfigurationOperator configurationOperator,
                                ITestsScheduler scheduler,
                                ITestReprocessor reprocessor,
                                ExceptionCatcher exceptionCatcher,
                                IConnectionProvider connectionProvider)
        {
            // Initializing fields
            this.projects = projects;
            this.results = results;
            this.log = log;
            this.testsRetriever = testsRetriever;
            this.configurationOperator = configurationOperator;
            this.scheduler = scheduler;
            this.reprocessor = reprocessor;
            this.exceptionCatcher = exceptionCatcher;
            this.connectionProvider = connectionProvider;
            this.requests = requests;
            this.agents = agents;
            this.tests = tests;

            // Binding to request collection events
            requests.Added += (sender, args) => RunAsynchronously(() => ProcessRequest(args.Data));

            // Binding to agent collection events
            agents.ReadyAgentAppeared += (sender, args) => RunAsynchronously(TryToRunIfAvailable);
            agents.ClientDisconnectedOrFailed += (sender, args) => RunAsynchronously(TryToRunIfAvailable);

            // Binding to test collection events
            tests.AvailableAdded += (sender, args) => RunAsynchronously(TryToRunIfAvailable);
        }