示例#1
0
        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();
            }
        }
示例#2
0
        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");
        }
示例#3
0
        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");
        }