public void TestRemove1() { _storage.AnalysisTemplates.Should().BeEmpty(); var analysis = _storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate()); _storage.AnalysisTemplates.Should().HaveCount(1); IAnalysis unused; _storage.TryGetAnalysisFor(analysis.Id, out unused).Should().BeTrue(); _storage.Remove(analysis.Id); _storage.AnalysisTemplates.Should().BeEmpty("because the only analysis should've been removed"); _storage.TryGetAnalysisFor(analysis.Id, out unused).Should().BeFalse("because the only analysis should've been removed"); }
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 TestRemove1() { var storage = new AnalysisStorage(_taskScheduler, _filesystem, _logAnalyserEngine.Object, _typeFactory); storage.AnalysisTemplates.Should().BeEmpty(); var analysis = storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate()); storage.AnalysisTemplates.Should().HaveCount(1); IAnalysis unused; storage.TryGetAnalysisFor(analysis.Id, out unused).Should().BeTrue(); storage.Remove(analysis.Id); storage.AnalysisTemplates.Should().BeEmpty("because the only analysis should've been removed"); storage.TryGetAnalysisFor(analysis.Id, out unused).Should().BeFalse("because the only analysis should've been removed"); }