예제 #1
0
        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");
        }
예제 #2
0
        public void TestRemove2()
        {
            var storage = new AnalysisStorage(_taskScheduler,
                                              _filesystem,
                                              _logAnalyserEngine.Object,
                                              _typeFactory);
            var analysis = storage.CreateAnalysis(new AnalysisTemplate(), new AnalysisViewTemplate());

            ((ActiveAnalysis)analysis).IsDisposed.Should().BeFalse();

            storage.Remove(analysis.Id);
            ((ActiveAnalysis)analysis).IsDisposed.Should().BeTrue("because the storage created the analysis so it should dispose of it as well");
        }
예제 #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");
        }
예제 #4
0
        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");
        }