Esempio n. 1
0
        public void TestCreateNew()
        {
            var sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object, _pluginRegistry);

            sidePanel.HasActiveAnalyses.Should().BeFalse();
            sidePanel.Active.Should().BeEmpty();
            sidePanel.CreateNewAnalysis();
            sidePanel.HasActiveAnalyses.Should().BeTrue();
            sidePanel.Active.Should().HaveCount(1);
        }
Esempio n. 2
0
        public void TestRemoveAnalysis1()
        {
            var sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object, _pluginRegistry);
            var viewModel = sidePanel.CreateNewAnalysis();

            sidePanel.Active.Should().HaveCount(1);

            viewModel.RemoveCommand.Execute(null);
            sidePanel.Active.Should().BeEmpty("because we've just removed the only analysis");
        }
Esempio n. 3
0
        public void TestRemoveAnalysis2()
        {
            var sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object, _pluginRegistry);
            var viewModel = sidePanel.CreateNewAnalysis();

            sidePanel.Active.Should().HaveCount(1);

            _analysisStorage.Verify(x => x.Remove(It.IsAny <AnalysisId>()), Times.Never);
            viewModel.RemoveCommand.Execute(null);
            _analysisStorage.Verify(x => x.Remove(It.Is <AnalysisId>(y => y == viewModel.Id)), Times.Once,
                                    "because the view model is responsible for removing the analysis (so it doesn't continue to run in the background)");
        }
Esempio n. 4
0
        public void TestUpdateSelectAnalysis()
        {
            var sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object, _pluginRegistry);

            sidePanel.SelectedAnalysis.Should().BeNull();

            sidePanel.Update();
            sidePanel.SelectedAnalysis.Should().BeNull();

            AddAnalysis();
            sidePanel.Update();
            sidePanel.SelectedAnalysis.Should().NotBeNull("because now that an analysis has become available, it should be selected as well!");
        }
Esempio n. 5
0
        public void Setup()
        {
            _dispatcher    = new ManualDispatcher();
            _taskScheduler = new ManualTaskScheduler();

            _analysisStorage = new Mock <IAnalysisStorage>();
            _analysisStorage.Setup(x => x.CreateAnalysis(It.IsAny <AnalysisTemplate>(), It.IsAny <AnalysisViewTemplate>()))
            .Returns((AnalysisTemplate templates, AnalysisViewTemplate viewTemplate) =>
            {
                var analysis = new Mock <IAnalysis>();
                var id       = AnalysisId.CreateNew();
                analysis.Setup(x => x.Id).Returns(id);
                return(analysis.Object);
            });

            _sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object);
        }