private ITreeNode addClassifiableQualificationPlanToTree(ITreeNode <IClassification> classificationNode, ClassifiableQualificationPlan classifiableQualificationPlan)
        {
            var qualificationPlanNode = _treeNodeFactory.CreateFor(classifiableQualificationPlan)
                                        .WithIcon(_buildingBlockIconRetriever.IconFor(classifiableQualificationPlan.QualificationPlan));

            AddClassifiableNodeToView(qualificationPlanNode, classificationNode);
            return(qualificationPlanNode);
        }
        protected override void Context()
        {
            _buildingBlockIconRetriever = A.Fake <IBuildingBlockIconRetriever>();
            _view = A.Fake <ISimulationExplorerView>();
            A.CallTo(() => _view.TreeView).Returns(A.Fake <IUxTreeView>());
            _treeNodeFactory    = A.Fake <ITreeNodeFactory>();
            _contextMenuFactory = A.Fake <ITreeNodeContextMenuFactory>();
            _regionResolver     = A.Fake <IRegionResolver>();
            _buildingBlockInSimulationManager = A.Fake <IBuildingBlockInSimulationManager>();
            _buildingBlockTask  = A.Fake <IBuildingBlockTask>();
            _toolTipNodeCreator = A.Fake <IToolTipPartCreator>();
            _projectRetriever   = A.Fake <IProjectRetriever>();
            _multipleTreeNodeContextMenuFactory      = A.Fake <IMultipleTreeNodeContextMenuFactory>();
            _parameterAnalysablesInExplorerPresenter = A.Fake <IParameterAnalysablesInExplorerPresenter>();

            _simulationFolderNode        = new RootNode(RootNodeTypes.SimulationFolder);
            _comparisonFolderNode        = new RootNode(RootNodeTypes.ComparisonFolder);
            _qualificationPlanFolderNode = new RootNode(RootNodeTypes.ComparisonFolder);
            _project          = new PKSimProject();
            _usedObservedData = new UsedObservedData {
                Id = "UsedData"
            };
            _simulation           = new IndividualSimulation().WithName("individualSimulation").WithId("individualSimulation");
            _populationSimulation = new PopulationSimulation().WithName("populationSimulation").WithId("populationSimulation");
            _importedSimulaton    = A.Fake <Simulation>().WithName("ImportedSimulation").WithId("ImportedSimulation");
            A.CallTo(() => _importedSimulaton.IsImported).Returns(true);
            _simulation.Properties                   = new SimulationProperties();
            _simulation.ModelProperties              = new ModelProperties();
            _simulation.ModelConfiguration           = A.Fake <ModelConfiguration>();
            _populationSimulation.Properties         = new SimulationProperties();
            _populationSimulation.ModelProperties    = new ModelProperties();
            _populationSimulation.ModelConfiguration = A.Fake <ModelConfiguration>();
            _classificationPresenter                 = A.Fake <IClassificationPresenter>();
            _project.AddBuildingBlock(_simulation);
            _project.AddBuildingBlock(_populationSimulation);
            var classifiableIndividualSimulation = new ClassifiableSimulation {
                Subject = _simulation
            };
            var classfiablePopulationSimulation = new ClassifiableSimulation {
                Subject = _populationSimulation
            };
            var classifiableImportSimulation = new ClassifiableSimulation {
                Subject = _importedSimulaton
            };

            _project.AddClassifiable(classifiableIndividualSimulation);
            _project.AddClassifiable(classfiablePopulationSimulation);
            _individualSimulationNode = new SimulationNode(classifiableIndividualSimulation);
            _populationSimulationNode = new SimulationNode(classfiablePopulationSimulation);
            _importedSimulationNode   = new SimulationNode(classifiableImportSimulation);
            _usedObservedDataNode     = A.Fake <ITreeNode>();
            A.CallTo(() => _treeNodeFactory.CreateFor(classifiableIndividualSimulation)).Returns(_individualSimulationNode);
            A.CallTo(() => _treeNodeFactory.CreateFor(classfiablePopulationSimulation)).Returns(_populationSimulationNode);
            A.CallTo(() => _treeNodeFactory.CreateFor(classifiableImportSimulation)).Returns(_importedSimulationNode);
            A.CallTo(() => _treeNodeFactory.CreateFor(_usedObservedData)).Returns(_usedObservedDataNode);
            _project.AddBuildingBlock(_importedSimulaton);

            var simulationComparison   = A.Fake <ISimulationComparison>().WithId("SimComp_Id");
            var classifiableComparison = new ClassifiableComparison {
                Subject = simulationComparison
            };

            _comparisonNode = new ComparisonNode(classifiableComparison);
            _project.AddSimulationComparison(simulationComparison);
            A.CallTo(() => _treeNodeFactory.CreateFor(classifiableComparison)).Returns(_comparisonNode);

            var qualificationPlan = new QualificationPlan {
                Id = "QP_ID"
            };
            var classifiableQualificationPlan = new ClassifiableQualificationPlan {
                Subject = qualificationPlan
            };

            _qualificationPlanNode = new QualificationPlanNode(classifiableQualificationPlan);
            _project.AddQualificationPlan(qualificationPlan);
            A.CallTo(() => _treeNodeFactory.CreateFor(classifiableQualificationPlan)).Returns(_qualificationPlanNode);

            _usedCompoundBuildingBlock = new UsedBuildingBlock("toto", PKSimBuildingBlockType.Compound)
            {
                Id = "usedBB"
            };
            _simulation.AddUsedBuildingBlock(_usedCompoundBuildingBlock);
            _simulation.AddUsedObservedData(_usedObservedData);

            _project.AddClassifiable(classifiableComparison);
            _project.AddClassifiable(classifiableQualificationPlan);

            _templageCompoundBuildingBlock = A.Fake <IPKSimBuildingBlock>();
            _usedBuildingBlockNode         = new UsedBuildingBlockInSimulationNode(_simulation, _usedCompoundBuildingBlock, _templageCompoundBuildingBlock);
            A.CallTo(() => _treeNodeFactory.CreateFor(_simulation, _usedCompoundBuildingBlock)).Returns(_usedBuildingBlockNode);
            A.CallTo(() => _buildingBlockIconRetriever.IconFor(_simulation)).Returns(ApplicationIcons.SimulationGreen);
            A.CallTo(() => _buildingBlockIconRetriever.IconFor(_populationSimulation)).Returns(ApplicationIcons.SimulationGreen);
            A.CallTo(() => _buildingBlockIconRetriever.IconFor(_usedCompoundBuildingBlock)).Returns(ApplicationIcons.CompoundRed);
            A.CallTo(() => _view.TreeView.NodeById(_simulation.Id)).Returns(_individualSimulationNode);
            A.CallTo(() => _view.TreeView.NodeById(_usedCompoundBuildingBlock.Id)).Returns(_usedBuildingBlockNode);
            A.CallTo(() => _view.TreeView.NodeById(RootNodeTypes.SimulationFolder.Id)).Returns(_simulationFolderNode);
            A.CallTo(() => _view.TreeView.NodeById(RootNodeTypes.ComparisonFolder.Id)).Returns(_comparisonFolderNode);
            A.CallTo(() => _view.TreeView.NodeById(RootNodeTypes.QualificationPlanFolder.Id)).Returns(_qualificationPlanFolderNode);

            _observedDataInSimulationManager = A.Fake <IObservedDataInSimulationManager>();
            sut = new SimulationExplorerPresenter(_view, _treeNodeFactory, _contextMenuFactory, _multipleTreeNodeContextMenuFactory, _buildingBlockIconRetriever,
                                                  _regionResolver, _buildingBlockTask, _buildingBlockInSimulationManager, _toolTipNodeCreator, _projectRetriever, _classificationPresenter, _parameterAnalysablesInExplorerPresenter, _observedDataInSimulationManager);

            A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project);
        }
 private ITreeNode addClassifiableQualificationPlanToRootFolder(ClassifiableQualificationPlan classifiableQualificationPlan)
 {
     return(AddClassifiableToTree(classifiableQualificationPlan, RootNodeTypes.QualificationPlanFolder, addClassifiableQualificationPlanToTree));
 }
Exemple #4
0
 public ITreeNode CreateFor(ClassifiableQualificationPlan classifiableQualificationPlan) => new QualificationPlanNode(classifiableQualificationPlan);