public void TestConstructionTwoAnalysers() { _template.Add(new AnalyserTemplate()); _template.Add(new AnalyserTemplate()); var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _dataSourceAnalyserEngine, TimeSpan.Zero); activeAnalysis.Analysers.Should().HaveCount(2); _template.Analysers.Should().HaveCount(2, "because the template may not have been modified by the ctor"); }
/// <summary> /// </summary> /// <param name="factoryId"></param> /// <param name="configuration"></param> /// <returns></returns> public IDataSourceAnalyser Add(LogAnalyserFactoryId factoryId, ILogAnalyserConfiguration configuration) { var template = new AnalyserTemplate { Id = AnalyserId.CreateNew(), FactoryId = factoryId, Configuration = configuration }; var analyser = new DataSourceAnalyser(template, _logFile, _logAnalyserEngine); try { analyser.Configuration = configuration; lock (_syncRoot) { _analysers.Add(analyser, template); _template.Add(template); } return(analyser); } catch (Exception) { analyser.Dispose(); throw; } }
/// <summary> /// </summary> /// <param name="pluginId"></param> /// <param name="configuration"></param> /// <returns></returns> public IDataSourceAnalyser Add(AnalyserPluginId pluginId, ILogAnalyserConfiguration configuration) { var template = new AnalyserTemplate { Id = AnalyserId.CreateNew(), AnalyserPluginId = pluginId, Configuration = configuration }; var analyser = Add(template); _template.Add(template); return(analyser); }