public void TestRestoreSavedAnalysis() { AnalysisId id; { var storage = new AnalysisStorage(_taskScheduler, _filesystem, _logAnalyserEngine.Object, _typeFactory); var analysis = storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate()); id = analysis.Id; var file = _filesystem.GetFileInfo(AnalysisStorage.GetFilename(analysis.Id)); file.Exists.Result.Should().BeTrue("because CreateAnalysis() should've written the analysis to disk"); } { var storage = new AnalysisStorage(_taskScheduler, _filesystem, _logAnalyserEngine.Object, _typeFactory); storage.Analyses.Should().HaveCount(1); storage.AnalysisTemplates.Should().HaveCount(1); var analysis = storage.Analyses.First(); analysis.Should().NotBeNull(); analysis.Id.Should().Be(id); storage.TryGetAnalysisFor(analysis.Id, out var actualAnalysis).Should().BeTrue(); actualAnalysis.Should().BeSameAs(analysis); storage.TryGetTemplateFor(analysis.Id, out var configuration).Should().BeTrue(); configuration.Should().NotBeNull(); configuration.Template.Should().NotBeNull(); configuration.ViewTemplate.Should().NotBeNull(); } }
public void TestRemove3() { var analysis = _storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate()); ((ActiveAnalysis)analysis).IsDisposed.Should().BeFalse(); var file = _filesystem.GetFileInfo(AnalysisStorage.GetFilename(analysis.Id)); file.Exists.Result.Should().BeTrue("because CreateAnalysis() should've written the analysis to disk"); _storage.Remove(analysis.Id); file.Exists.Result.Should().BeFalse("because Remove should've also removed the analysis from disk"); }
public void TestRemove3() { var storage = new AnalysisStorage(_taskScheduler, _filesystem, _logAnalyserEngine.Object, _typeFactory); var analysis = storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate()); ((ActiveAnalysis)analysis).IsDisposed.Should().BeFalse(); var file = _filesystem.GetFileInfo(AnalysisStorage.GetFilename(analysis.Id)); file.Exists.Result.Should().BeTrue("because CreateAnalysis() should've written the analysis to disk"); storage.Remove(analysis.Id); file.Exists.Result.Should().BeFalse("because Remove should've also removed the analysis from disk"); }