public void TestAddLogFileThenAddWidget() { 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); var id = DataSourceId.CreateNew(); var logFile = new Mock <ILogFile>(); activeAnalysis.Add(id, logFile.Object); activeAnalysis.Add(AnalyserPluginId.Empty, new TestLogAnalyserConfiguration()); analyser.Verify(x => x.OnLogFileAdded(id, logFile.Object), Times.Once, "because we've just added a log file for analysis and thus the analyser should have been notified"); }
public void TestTryGetNonExistentAnalyser() { var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _dataSourceAnalyserEngine, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var configuration = new Mock <ILogAnalyserConfiguration>().Object; activeAnalysis.Add(new AnalyserPluginId("foobar"), configuration); activeAnalysis.TryGetAnalyser(AnalyserId.CreateNew(), out var actualAnalyser).Should().BeFalse(); actualAnalyser.Should().BeNull(); }
public void TestTryGetAnalyser() { var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _analysisEngine.Object, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var configuration = new Mock <ILogAnalyserConfiguration>().Object; var analyser = activeAnalysis.Add(new LogAnalyserFactoryId("foobar"), configuration); activeAnalysis.TryGetAnalyser(analyser.Id, out var actualAnalyser).Should().BeTrue(); actualAnalyser.Should().BeSameAs(analyser); }
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 TestAdd1() { var activeAnalysis = new ActiveAnalysis(AnalysisId.CreateNew(), _template, _taskScheduler, _dataSourceAnalyserEngine, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var configuration = new Mock <ILogAnalyserConfiguration>().Object; var analyser = activeAnalysis.Add(new AnalyserPluginId("foobar"), configuration); _template.Analysers.Should().HaveCount(1); var template = _template.Analysers.First(); template.Id.Should().Be(analyser.Id); template.AnalyserPluginId.Should().Be(new AnalyserPluginId("foobar")); template.Configuration.Should().Be(configuration); }
public void TestAdd1() { var group = new ActiveAnalysis(_template, _taskScheduler, _analysisEngine.Object, TimeSpan.Zero); _template.Analysers.Should().BeEmpty(); var configuration = new Mock <ILogAnalyserConfiguration>().Object; var analyser = group.Add(new LogAnalyserFactoryId("foobar"), configuration); _template.Analysers.Should().HaveCount(1); var template = _template.Analysers.First(); template.Id.Should().Be(analyser.Id); template.FactoryId.Should().Be(new LogAnalyserFactoryId("foobar")); template.Configuration.Should().Be(configuration); }
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(); }