protected override Task Context() { _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>(); _processMappingMapper = A.Fake <ProcessMappingMapper>(); _logger = A.Fake <ILogger>(); _project = new PKSimProject(); _calculationMethodSnapshot = new CalculationMethodCache(); sut = new CompoundPropertiesMapper(_calculationMethodCacheMapper, _processMappingMapper, _logger); _compoungGroupSelectionOneAlternative = new CompoundGroupSelection { AlternativeName = "ALT1", GroupName = "ALTERNATIVE_GROUP_1" }; _compoungGroupSelectioTwoAlternatives = new CompoundGroupSelection { AlternativeName = "ALT2", GroupName = "ALTERNATIVE_GROUP_2" }; _compound = new Compound { Name = "COMP", }; _protocol = new SimpleProtocol { Name = "PROTOCOL" }; _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup { Name = _compoungGroupSelectionOneAlternative.GroupName }; _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup { Name = _compoungGroupSelectioTwoAlternatives.GroupName }; _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative { Name = "ALT1" }); _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative { Name = "ALT2" }); _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithOneAlternative); _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithTwoAlternatives); _compoundProperties = new Model.CompoundProperties(); _compoundProperties.AddCompoundGroupSelection(_compoungGroupSelectionOneAlternative); _compoundProperties.AddCompoundGroupSelection(_compoungGroupSelectioTwoAlternatives); _compoundProperties.Compound = _compound; _enzymaticProcess = new EnzymaticProcess { Name = "EnzymaticProcess" }; _specificBindingProcess = new SpecificBindingPartialProcess { Name = "SpecificBinding" }; _transportProcess = new SystemicProcess { Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR }; _compound.AddProcess(_enzymaticProcess); _compound.AddProcess(_specificBindingProcess); _compound.AddProcess(_transportProcess); _enzymaticPartialProcessSelection = new EnzymaticProcessSelection { ProcessName = _enzymaticProcess.Name }; _specificBindingPartialProcessSelection = new ProcessSelection { ProcessName = _specificBindingProcess.Name }; _transportSystemicProcessSelection = new SystemicProcessSelection { ProcessName = _transportProcess.Name, ProcessType = _transportProcess.SystemicProcessType, }; _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection); _compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(_specificBindingPartialProcessSelection); _compoundProperties.Processes.TransportAndExcretionSelection.AddSystemicProcessSelection(_transportSystemicProcessSelection); _snapshotProcess1 = new CompoundProcessSelection { Name = _enzymaticPartialProcessSelection.ProcessName }; _snapshotProcess2 = new CompoundProcessSelection { Name = _specificBindingPartialProcessSelection.ProcessName }; _snapshotProcess3 = new CompoundProcessSelection { Name = _transportSystemicProcessSelection.ProcessName }; _formulation = new Formulation { Id = "123456" }; _compoundProperties.ProtocolProperties.Protocol = _protocol; _compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping { FormulationKey = "F1", TemplateFormulationId = _formulation.Id }); _project.AddBuildingBlock(_formulation); A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compoundProperties.CalculationMethodCache)).Returns(_calculationMethodSnapshot); A.CallTo(() => _processMappingMapper.MapToSnapshot(_enzymaticPartialProcessSelection)).Returns(_snapshotProcess1); A.CallTo(() => _processMappingMapper.MapToSnapshot(_specificBindingPartialProcessSelection)).Returns(_snapshotProcess2); A.CallTo(() => _processMappingMapper.MapToSnapshot(_transportSystemicProcessSelection)).Returns(_snapshotProcess3); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, _enzymaticProcess)).Returns(_enzymaticPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, _specificBindingProcess)).Returns(_specificBindingPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, _transportProcess)).Returns(_transportSystemicProcessSelection); return(_completed); }
public CompoundPropertiesContext(PKSimProject project, Model.Simulation simulation) { Project = project; Simulation = simulation; }
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); _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>(); var classifiableComparison = new ClassifiableComparison { Subject = simulationComparison }; _comparisonNode = new ComparisonNode(classifiableComparison); _project.AddSimulationComparison(simulationComparison); A.CallTo(() => _treeNodeFactory.CreateFor(classifiableComparison)).Returns(_comparisonNode); _usedCompoundBuildingBlock = new UsedBuildingBlock("toto", PKSimBuildingBlockType.Compound) { Id = "usedBB" }; _simulation.AddUsedBuildingBlock(_usedCompoundBuildingBlock); _simulation.AddUsedObservedData(_usedObservedData); _project.AddClassifiable(classifiableComparison); _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); _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); }