public void TestAddRemove1() { var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _dataSourceAnalyserEngine, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var analyser = activeAnalysis.Add(new AnalyserPluginId("foobar"), null); _template.Analysers.Should().HaveCount(1); activeAnalysis.Remove(analyser); _template.Analysers.Should().BeEmpty(); }
public void TestAddRemove1() { var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _analysisEngine.Object, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var analyser = activeAnalysis.Add(new LogAnalyserFactoryId("foobar"), null); _template.Analysers.Should().HaveCount(1); activeAnalysis.Remove(analyser); _template.Analysers.Should().BeEmpty(); }
public void TestAddRemoveCustomAnalyzer1() { var pluginLoader = new PluginRegistry(); var id = new AnalyserPluginId("stuff"); var plugin = new Mock <IDataSourceAnalyserPlugin>(); plugin.Setup(x => x.Id).Returns(id); pluginLoader.Register(plugin.Object); _dataSourceAnalyserEngine = new DataSourceAnalyserEngine(_taskScheduler, _logAnalyserEngine.Object, pluginLoader); var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _dataSourceAnalyserEngine, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var analyser = activeAnalysis.Add(id, null); _template.Analysers.Should().HaveCount(1); activeAnalysis.Remove(analyser); _template.Analysers.Should().BeEmpty(); }
public void TestRemoveLogFile() { var engine = new Mock <IDataSourceAnalyserEngine>(); var analyser = new Mock <IDataSourceAnalyser>(); engine.Setup(x => x.CreateAnalyser(It.IsAny <ILogFile>(), It.IsAny <AnalyserTemplate>())) .Returns(analyser.Object); var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, engine.Object, TimeSpan.Zero); activeAnalysis.Add(AnalyserPluginId.Empty, new TestLogAnalyserConfiguration()); analyser.Verify(x => x.OnLogFileRemoved(It.IsAny <DataSourceId>(), It.IsAny <ILogFile>()), Times.Never, "because we haven't removed any log file from analysis just yet"); var id = DataSourceId.CreateNew(); var logFile = new Mock <ILogFile>(); activeAnalysis.Add(id, logFile.Object); analyser.Verify(x => x.OnLogFileRemoved(id, It.IsAny <ILogFile>()), Times.Never, "because we haven't removed any log file from analysis just yet"); activeAnalysis.Remove(id, logFile.Object); analyser.Verify(x => x.OnLogFileRemoved(id, logFile.Object), Times.Once, "because we've just removed a log file from analysis and thus the analyser should have been notified"); }