Пример #1
0
 protected SimulationWizardPresenter(TView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager,
                                     ISimulationModelCreator simulationModelCreator, IHeavyWorkManager heavyWorkManager, IDialogCreator dialogCreator)
     : base(view, subPresenterItemManager, SimulationItems.All, dialogCreator)
 {
     _simulationModelCreator = simulationModelCreator;
     _heavyWorkManager       = heavyWorkManager;
 }
Пример #2
0
 protected override void Context()
 {
     _objectBaseFactory = A.Fake <IObjectBaseFactory>();
     _simulationBuildingBlockUpdater = A.Fake <ISimulationBuildingBlockUpdater>();
     _simulationModelCreator         = A.Fake <ISimulationModelCreator>();
     _simulationParametersUpdater    = A.Fake <ISimulationParametersUpdater>();
     _modelPropertiesTask            = A.Fake <IModelPropertiesTask>();
     _cloner = A.Fake <ICloner>();
     _diagramModelFactory = A.Fake <IDiagramModelFactory>();
     _interactionTask     = A.Fake <IInteractionTask>();
     _individual          = A.Fake <Individual>();
     _compounds           = new List <Compound>();
     A.CallTo(() => _individual.BuildingBlockType).Returns(PKSimBuildingBlockType.Individual);
     _population = A.Fake <Population>();
     A.CallTo(() => _population.BuildingBlockType).Returns(PKSimBuildingBlockType.Population);
     _originData                = new OriginData();
     _modelProperties           = A.Fake <ModelProperties>();
     _individualSimulation      = A.Fake <IndividualSimulation>();
     _populationSimulation      = A.Fake <PopulationSimulation>();
     _objectIdResetter          = A.Fake <IObjectIdResetter>();
     _compoundPropertiesUpdater = A.Fake <ICompoundPropertiesUpdater>();
     A.CallTo(() => _objectBaseFactory.Create <IndividualSimulation>()).Returns(_individualSimulation);
     A.CallTo(() => _objectBaseFactory.Create <PopulationSimulation>()).Returns(_populationSimulation);
     _individual.OriginData = _originData;
     A.CallTo(() => _individual.Organism).Returns(A.Fake <Organism>());
     sut = new SimulationFactory(_objectBaseFactory,
                                 _simulationBuildingBlockUpdater, _simulationModelCreator, _objectIdResetter, _compoundPropertiesUpdater, _simulationParametersUpdater,
                                 _modelPropertiesTask, _cloner, _diagramModelFactory, _interactionTask);
 }
Пример #3
0
        protected override void Context()
        {
            _view = A.Fake <IConfigureSimulationView>();
            _subPresenterManager    = SubPresenterHelper.Create <ISimulationItemPresenter>();
            _simulationModelCreator = A.Fake <ISimulationModelCreator>();
            _heavyWorkManager       = new HeavyWorkManagerForSpecs();
            _cloner        = A.Fake <ICloner>();
            _dialogCreator = A.Fake <IDialogCreator>();
            _simulationParametersUpdater           = A.Fake <ISimulationParametersUpdater>();
            _fullPathDisplayResolver               = A.Fake <IFullPathDisplayResolver>();
            _buildingBlockInSimulationSynchronizer = A.Fake <IBuildingBlockInSimulationSynchronizer>();
            _validationResult = new ValidationResult();

            _simulationModelConfigurationPresenter = _subPresenterManager.CreateFake(SimulationItems.Model);
            _simulationCompoundsPresenter          = _subPresenterManager.CreateFake(SimulationItems.Compounds);
            _simulationCompoundProtocolsPresenter  = _subPresenterManager.CreateFake(SimulationItems.CompoundProtocols);
            _simulationCompoundProcessesPresenter  = _subPresenterManager.CreateFake(SimulationItems.CompoundsProcesses);
            _simulationEventsPresenter             = _subPresenterManager.CreateFake(SimulationItems.Events);

            sut = new ConfigureSimulationPresenter(_view, _subPresenterManager, _simulationModelCreator, _heavyWorkManager, _cloner, _dialogCreator, _simulationParametersUpdater, _fullPathDisplayResolver, _buildingBlockInSimulationSynchronizer);

            _originalSimulation = A.Fake <Simulation>();
            _clonedSimulation   = A.Fake <Simulation>();
            A.CallTo(() => _cloner.CloneForModel(_originalSimulation)).Returns(_clonedSimulation);
            A.CallTo(() => _simulationModelConfigurationPresenter.Simulation).Returns(_clonedSimulation);

            A.CallTo(_simulationParametersUpdater).WithReturnType <ValidationResult>().Returns(_validationResult);
        }
Пример #4
0
 public SimulationConstructor(ISimulationFactory simulationFactory, ISimulationBuildingBlockUpdater buildingBlockUpdater,
                              ISimulationModelCreator simulationModelCreator, IRegistrationTask registrationTask)
 {
     _simulationFactory      = simulationFactory;
     _buildingBlockUpdater   = buildingBlockUpdater;
     _simulationModelCreator = simulationModelCreator;
     _registrationTask       = registrationTask;
 }
 protected ConfigureSimulationPresenterBase(TSimulationView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager,
                                            ISimulationModelCreator simulationModelCreator, IHeavyWorkManager heavyWorkManager,
                                            ICloner cloner, IDialogCreator dialogCreator, ISimulationParametersUpdater simulationParametersUpdater, IFullPathDisplayResolver fullPathDisplayResolver, IBuildingBlockInSimulationSynchronizer buildingBlockInSimulationSynchronizer, CreationMode creationMode)
     : base(view, subPresenterItemManager, simulationModelCreator, heavyWorkManager, dialogCreator)
 {
     _cloner = cloner;
     _simulationParametersUpdater           = simulationParametersUpdater;
     _fullPathDisplayResolver               = fullPathDisplayResolver;
     _buildingBlockInSimulationSynchronizer = buildingBlockInSimulationSynchronizer;
     _creationMode    = creationMode;
     AllowQuickFinish = true;
 }
Пример #6
0
 public ProjectComparisonRunner(IWorkspacePersistor workspacePersistor, IWorkspace workspace,
                                ILazyLoadTask lazyLoadTask, IBatchLogger logger, ISimulationEngineFactory simulationEngineFactory, ISimulationExportTask simulationExportTask,
                                IMoBiExportTask moBiExportTask, ISimulationFactory simulationFactory, IExecutionContext executionContext, ISimulationModelCreator simulationModelCreator)
 {
     _workspacePersistor     = workspacePersistor;
     _workspace              = workspace;
     _lazyLoadTask           = lazyLoadTask;
     _logger                 = logger;
     _simulationExportTask   = simulationExportTask;
     _moBiExportTask         = moBiExportTask;
     _simulationFactory      = simulationFactory;
     _executionContext       = executionContext;
     _simulationModelCreator = simulationModelCreator;
     _simulationEngine       = simulationEngineFactory.Create <IndividualSimulation>();
 }
Пример #7
0
 public SimulationFactory(IObjectBaseFactory objectBaseFactory,
                          ISimulationBuildingBlockUpdater simulationBuildingBlockUpdater, ISimulationModelCreator simulationModelCreator,
                          IObjectIdResetter objectIdResetter, ICompoundPropertiesUpdater compoundPropertiesUpdater,
                          ISimulationParametersUpdater simulationParametersUpdater, IModelPropertiesTask modelPropertiesTask,
                          ICloner cloner, IDiagramModelFactory diagramModelFactory, IInteractionTask interactionTask)
 {
     _objectBaseFactory = objectBaseFactory;
     _simulationBuildingBlockUpdater = simulationBuildingBlockUpdater;
     _simulationModelCreator         = simulationModelCreator;
     _objectIdResetter            = objectIdResetter;
     _compoundPropertiesUpdater   = compoundPropertiesUpdater;
     _simulationParametersUpdater = simulationParametersUpdater;
     _modelPropertiesTask         = modelPropertiesTask;
     _cloner = cloner;
     _diagramModelFactory = diagramModelFactory;
     _interactionTask     = interactionTask;
 }
Пример #8
0
 public SimulationMapper(
     SolverSettingsMapper solverSettingsMapper,
     OutputSchemaMapper outputSchemaMapper,
     OutputSelectionsMapper outputSelectionsMapper,
     CompoundPropertiesMapper compoundPropertiesMapper,
     ParameterMapper parameterMapper,
     AdvancedParameterMapper advancedParameterMapper,
     EventMappingMapper eventMappingMapper,
     ObserverSetMappingMapper observerSetMappingMapper,
     SimulationTimeProfileChartMapper simulationTimeProfileChartMapper,
     PopulationAnalysisChartMapper populationAnalysisChartMapper,
     ProcessMappingMapper processMappingMapper,
     ISimulationFactory simulationFactory,
     IExecutionContext executionContext,
     ISimulationModelCreator simulationModelCreator,
     ISimulationBuildingBlockUpdater simulationBuildingBlockUpdater,
     IModelPropertiesTask modelPropertiesTask,
     ISimulationRunner simulationRunner,
     ISimulationParameterOriginIdUpdater simulationParameterOriginIdUpdater,
     ILogger logger,
     IContainerTask containerTask,
     IEntityPathResolver entityPathResolver
     )
 {
     _solverSettingsMapper               = solverSettingsMapper;
     _outputSchemaMapper                 = outputSchemaMapper;
     _outputSelectionsMapper             = outputSelectionsMapper;
     _compoundPropertiesMapper           = compoundPropertiesMapper;
     _parameterMapper                    = parameterMapper;
     _advancedParameterMapper            = advancedParameterMapper;
     _eventMappingMapper                 = eventMappingMapper;
     _observerSetMappingMapper           = observerSetMappingMapper;
     _simulationTimeProfileChartMapper   = simulationTimeProfileChartMapper;
     _populationAnalysisChartMapper      = populationAnalysisChartMapper;
     _processMappingMapper               = processMappingMapper;
     _simulationFactory                  = simulationFactory;
     _executionContext                   = executionContext;
     _simulationModelCreator             = simulationModelCreator;
     _simulationBuildingBlockUpdater     = simulationBuildingBlockUpdater;
     _modelPropertiesTask                = modelPropertiesTask;
     _simulationRunner                   = simulationRunner;
     _simulationParameterOriginIdUpdater = simulationParameterOriginIdUpdater;
     _logger             = logger;
     _containerTask      = containerTask;
     _entityPathResolver = entityPathResolver;
 }
        protected override void Context()
        {
            _simulationPropertiesDTO = new ObjectBaseDTO();
            _subPresenterManager     = SubPresenterHelper.Create <ISimulationItemPresenter>();
            _simulationModelConfigurationPresenter             = _subPresenterManager.CreateFake(SimulationItems.Model);
            _simulationCompoundConfigurationCollectorPresenter = _subPresenterManager.CreateFake(SimulationItems.Compounds);
            _simulationCompoundProtocolCollectorPresenter      = _subPresenterManager.CreateFake(SimulationItems.CompoundProtocols);
            _simulationCompoundProcessCollectorPresenter       = _subPresenterManager.CreateFake(SimulationItems.CompoundsProcesses);
            _simulationEventsConfigurationPresenter            = _subPresenterManager.CreateFake(SimulationItems.Events);
            _view = A.Fake <ICreateSimulationView>();
            _buildingBlockDTOFactory    = A.Fake <IObjectBaseDTOFactory>();
            _simulationPropertiesMapper = A.Fake <IBuildingBlockPropertiesMapper>();
            A.CallTo(() => _buildingBlockDTOFactory.CreateFor <Simulation>()).Returns(_simulationPropertiesDTO);
            _simulationModelCreator = A.Fake <ISimulationModelCreator>();
            _heavyWorkManager       = new HeavyWorkManagerForSpecs();
            _dialogCreator          = A.Fake <IDialogCreator>();

            sut = new CreateSimulationPresenter(_view, _subPresenterManager, _simulationModelCreator, _heavyWorkManager, _simulationPropertiesMapper, _buildingBlockDTOFactory, _dialogCreator);
            sut.Initialize();
        }
Пример #10
0
 public CloneSimulationPresenter(ICloneSimulationView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager, ISimulationModelCreator simulationModelCreator,
                                 IHeavyWorkManager heavyWorkManager, ICloner cloner, IDialogCreator dialogCreator, IObjectBaseDTOFactory buildingBlockDTOFactory,
                                 IRenameBuildingBlockTask renameBuildingBlockTask, ISimulationParametersUpdater simulationParametersUpdater, IFullPathDisplayResolver fullPathDisplayResolver, IBuildingBlockInSimulationSynchronizer buildingBlockInSimulationSynchronizer)
     : base(view, subPresenterItemManager, simulationModelCreator, heavyWorkManager, cloner, dialogCreator, simulationParametersUpdater, fullPathDisplayResolver, buildingBlockInSimulationSynchronizer, CreationMode.Clone)
 {
     _buildingBlockDTOFactory = buildingBlockDTOFactory;
     _renameBuildingBlockTask = renameBuildingBlockTask;
 }
Пример #11
0
        protected override Task Context()
        {
            _solverSettingsMapper               = A.Fake <SolverSettingsMapper>();
            _outputSchemaMapper                 = A.Fake <OutputSchemaMapper>();
            _outputSelectionMapper              = A.Fake <OutputSelectionsMapper>();
            _parameterMapper                    = A.Fake <ParameterMapper>();
            _compoundPropertiesMapper           = A.Fake <CompoundPropertiesMapper>();
            _advancedParameterMapper            = A.Fake <AdvancedParameterMapper>();
            _eventMappingMapper                 = A.Fake <EventMappingMapper>();
            _observerSetMappingMapper           = A.Fake <ObserverSetMappingMapper>();
            _curveChartMapper                   = A.Fake <SimulationTimeProfileChartMapper>();
            _processMappingMapper               = A.Fake <ProcessMappingMapper>();
            _simulationFactory                  = A.Fake <ISimulationFactory>();
            _executionContext                   = A.Fake <IExecutionContext>();
            _simulationModelCreator             = A.Fake <ISimulationModelCreator>();
            _simulationBuildingBlockUpdater     = A.Fake <ISimulationBuildingBlockUpdater>();
            _modelPropertiesTask                = A.Fake <IModelPropertiesTask>();
            _simulationRunner                   = A.Fake <ISimulationRunner>();
            _populationAnalysisChartMapper      = A.Fake <PopulationAnalysisChartMapper>();
            _simulationParameterOriginIdUpdater = A.Fake <ISimulationParameterOriginIdUpdater>();
            _logger             = A.Fake <ILogger>();
            _containerTask      = A.Fake <IContainerTask>();
            _entityPathResolver = A.Fake <IEntityPathResolver>();

            sut = new SimulationMapper(_solverSettingsMapper, _outputSchemaMapper,
                                       _outputSelectionMapper, _compoundPropertiesMapper, _parameterMapper,
                                       _advancedParameterMapper, _eventMappingMapper, _observerSetMappingMapper, _curveChartMapper,
                                       _populationAnalysisChartMapper, _processMappingMapper,
                                       _simulationFactory, _executionContext, _simulationModelCreator,
                                       _simulationBuildingBlockUpdater, _modelPropertiesTask,
                                       _simulationRunner, _simulationParameterOriginIdUpdater,
                                       _logger, _containerTask, _entityPathResolver
                                       );

            _project    = new PKSimProject();
            _individual = new Individual {
                Name = "IND", Id = "IND"
            };
            _compound = new Compound {
                Name = "COMP", Id = "COMP"
            };
            _observerSet = new ObserverSet {
                Name = "OBS_SET", Id = "OBS_SET"
            };
            _protocol = new SimpleProtocol {
                Name = "PROT", Id = "PROT"
            };
            _inductionProcess = new InductionProcess().WithName("Interaction process");
            _compound.AddProcess(_inductionProcess);


            _event = new PKSimEvent {
                Name = "Event"
            };
            _population = new RandomPopulation()
            {
                Name = "POP"
            };
            _observedData = new DataRepository("OBS_ID").WithName("OBS");
            _project.AddBuildingBlock(_individual);
            _project.AddBuildingBlock(_compound);
            _project.AddBuildingBlock(_event);
            _project.AddBuildingBlock(_population);
            _project.AddBuildingBlock(_observerSet);
            _project.AddObservedData(_observedData);

            _simulationProperties = new SimulationProperties
            {
                ModelProperties = new ModelProperties
                {
                    ModelConfiguration = new ModelConfiguration {
                        ModelName = "4Comp"
                    }
                }
            };
            _interactionSelection = new InteractionSelection {
                ProcessName = _inductionProcess.Name
            };
            _noInteractionSelection = new InteractionSelection {
                MoleculeName = "CYP2D6"
            };

            _simulationProperties.InteractionProperties.AddInteraction(_interactionSelection);
            _simulationProperties.InteractionProperties.AddInteraction(_noInteractionSelection);

            _settings      = new SimulationSettings();
            _rootContainer = new Container().WithName("Sim");
            _model         = new OSPSuite.Core.Domain.Model {
                Root = _rootContainer
            };

            _individualSimulation = new IndividualSimulation
            {
                Name               = "S1",
                Properties         = _simulationProperties,
                SimulationSettings = _settings,
                Description        = "Simulation Description",
                Model              = _model
            };

            _simulationTimeProfile         = new SimulationTimeProfileChart();
            _snapshotSimulationTimeProfile = new CurveChart();
            _individualSimulation.AddAnalysis(_simulationTimeProfile);

            A.CallTo(() => _curveChartMapper.MapToSnapshot(_simulationTimeProfile)).Returns(_snapshotSimulationTimeProfile);


            _populationSimulation = new PopulationSimulation
            {
                Properties         = _simulationProperties,
                SimulationSettings = _settings,
                Model = _model
            };

            _advancedParameterCollection       = new AdvancedParameterCollection();
            _populationSimulationAnalysisChart = new BoxWhiskerAnalysisChart();
            _populationSimulation.SetAdvancedParameters(_advancedParameterCollection);
            _populationSimulation.AddAnalysis(_populationSimulationAnalysisChart);
            _populationSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual
            });

            _snapshotPopulationAnalysisChart = new Snapshots.PopulationAnalysisChart();

            A.CallTo(() => _populationAnalysisChartMapper.MapToSnapshot(_populationSimulationAnalysisChart)).Returns(_snapshotPopulationAnalysisChart);

            _snapshotInteraction = new CompoundProcessSelection();
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_interactionSelection)).Returns(_snapshotInteraction);
            _snapshotInteraction.CompoundName = _compound.Name;
            _snapshotInteraction.Name         = _inductionProcess.Name;

            _noSelectionSnapshotInteraction = new CompoundProcessSelection();
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noInteractionSelection)).Returns(_noSelectionSnapshotInteraction);
            _noSelectionSnapshotInteraction.MoleculeName = _noInteractionSelection.MoleculeName;

            _compoundProperties         = new CompoundProperties();
            _snapshotCompoundProperties = new Snapshots.CompoundProperties {
                Name = _compound.Name
            };
            _individualSimulation.Properties.AddCompoundProperties(_compoundProperties);

            _eventMapping = new EventMapping();
            _individualSimulation.EventProperties.AddEventMapping(_eventMapping);

            _observerSetMapping = new ObserverSetMapping();
            _individualSimulation.ObserverSetProperties.AddObserverSetMapping(_observerSetMapping);

            A.CallTo(() => _compoundPropertiesMapper.MapToSnapshot(_compoundProperties, _project)).Returns(_snapshotCompoundProperties);


            _eventSelection = new EventSelection
            {
                Name = _event.Name,
            };

            _observerSetSelection = new ObserverSetSelection
            {
                Name = _observerSet.Name,
            };

            _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual,

                Altered = true
            });

            _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompTemplateId", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });

            _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("ProtTemplateId", PKSimBuildingBlockType.Protocol)
            {
                BuildingBlock = _protocol
            });

            _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("ObserveSetTemplateId", PKSimBuildingBlockType.ObserverSet)
            {
                BuildingBlock = _observerSet
            });

            _populationSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("PopTemplateId", PKSimBuildingBlockType.Population)
            {
                BuildingBlock = _population
            });


            _individualSimulation.AddUsedObservedData(_observedData);

            A.CallTo(() => _eventMappingMapper.MapToSnapshot(_eventMapping, _project)).Returns(_eventSelection);
            A.CallTo(() => _observerSetMappingMapper.MapToSnapshot(_observerSetMapping, _project)).Returns(_observerSetSelection);

            _outputSelectionSnapshot = new OutputSelections();
            A.CallTo(() => _outputSelectionMapper.MapToSnapshot(_individualSimulation.OutputSelections)).Returns(_outputSelectionSnapshot);

            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotInteraction, _inductionProcess)).Returns(_interactionSelection);

            return(_completed);
        }
Пример #12
0
 public ConfigureSimulationPresenter(IConfigureSimulationView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager, ISimulationModelCreator simulationModelCreator,
                                     IHeavyWorkManager heavyWorkManager, ICloner cloner, IDialogCreator dialogCreator, ISimulationParametersUpdater simulationParametersUpdater,
                                     IFullPathDisplayResolver fullPathDisplayResolver, IBuildingBlockInSimulationSynchronizer buildingBlockInSimulationSynchronizer)
     : base(view, subPresenterItemManager, simulationModelCreator, heavyWorkManager, cloner, dialogCreator, simulationParametersUpdater, fullPathDisplayResolver, buildingBlockInSimulationSynchronizer, CreationMode.Configure)
 {
 }
Пример #13
0
 public CreateSimulationPresenter(ICreateSimulationView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager, ISimulationModelCreator simulationModelCreator, IHeavyWorkManager heavyWorkManager, IBuildingBlockPropertiesMapper simulationPropertiesMapper, IObjectBaseDTOFactory buildingBlockDTOFactory, IDialogCreator dialogCreator)
     : base(view, subPresenterItemManager, simulationModelCreator, heavyWorkManager, dialogCreator)
 {
     _simulationPropertiesMapper = simulationPropertiesMapper;
     _buildingBlockDTOFactory    = buildingBlockDTOFactory;
 }