protected override void Context() { base.Context(); _key1 = "key1"; _key2 = "key2"; _key3 = "key3"; _key4 = "key4"; var loadedProtocol1 = A.Fake <Protocol>().WithName("P1"); loadedProtocol1.IsLoaded = true; A.CallTo(() => loadedProtocol1.UsedFormulationKeys).Returns(new[] { _key1, _key2 }); var notLoadedProtocol = A.Fake <Protocol>().WithName("P2"); A.CallTo(() => notLoadedProtocol.UsedFormulationKeys).Returns(new[] { "tralala" }); var loadedProtocol2 = A.Fake <Protocol>().WithName("P3"); loadedProtocol2.IsLoaded = true; A.CallTo(() => loadedProtocol2.UsedFormulationKeys).Returns(new[] { _key2, _key3 }); var project = new PKSimProject(); project.AddBuildingBlock(loadedProtocol1); project.AddBuildingBlock(loadedProtocol2); project.AddBuildingBlock(notLoadedProtocol); var formulation = new Formulation().WithName(_key4); project.AddBuildingBlock(formulation); A.CallTo(() => _projectRetriever.CurrentProject).Returns(project); }
protected override void Context() { _project = new PKSimProject(); _projectRetriever = A.Fake <IPKSimProjectRetriever>(); A.CallTo(() => _projectRetriever.Current).Returns(_project); _compound1 = A.Fake <Compound>(); _compound1.IsLoaded = false; _compound2 = new Compound { IsLoaded = true }; _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "A", Name = "P1" }); _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "C", Name = "P2" }); _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "B", Name = "P3" }); _individual1 = A.Fake <Individual>(); _individual1.IsLoaded = false; _individual2 = new Individual { IsLoaded = true }; _individual2.AddMolecule(new IndividualEnzyme().WithName("B")); _individual2.AddMolecule(new IndividualEnzyme().WithName("D")); _project.AddBuildingBlock(_compound1); _project.AddBuildingBlock(_compound2); _project.AddBuildingBlock(_individual1); _project.AddBuildingBlock(_individual2); sut = new UsedMoleculeRepository(_projectRetriever); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_individual); _project = new PKSimProject(); _snapshotContext = new SnapshotContext(_project, ProjectVersions.V11); _snapshot.Name = "New individual"; _snapshot.Description = "The description that will be deserialized"; //clear enzyme before mapping them again _individual.RemoveExpressionProfile(_expressionProfile1); _individual.RemoveExpressionProfile(_expressionProfile2); //reset parameter _parameterKidney.ResetToDefault(); _project.AddBuildingBlock(_expressionProfile1); _project.AddBuildingBlock(_expressionProfile2); _newOriginData = new Model.OriginData(); A.CallTo(() => _originDataMapper.MapToModel(_snapshot.OriginData, A <SnapshotContext> ._)).Returns(_newOriginData); A.CallTo(() => _individualFactory.CreateAndOptimizeFor(_newOriginData, _snapshot.Seed)) .Returns(_individual); }
protected override Task Context() { _individualSimulationComparisonMapper = A.Fake <IndividualSimulationComparisonMapper>(); _populationAnalysisChartMapper = A.Fake <PopulationAnalysisChartMapper>(); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); sut = new SimulationComparisonMapper(_individualSimulationComparisonMapper, _populationAnalysisChartMapper, _objectBaseFactory); _individualSimulation1 = new IndividualSimulation().WithName("IndS1").WithId("IndS1"); _individualSimulation2 = new IndividualSimulation().WithName("IndS2").WithId("IndS2"); _individualSimulationComparison = new IndividualSimulationComparison { Name = "IndividualComparison", Description = "IndividualComparison Description", }; _individualSimulationComparison.AddSimulation(_individualSimulation1); _individualSimulationComparison.AddSimulation(_individualSimulation2); _populationSimulation1 = new PopulationSimulation().WithName("PopS1").WithId("PopS1"); _populationSimulation2 = new PopulationSimulation().WithName("PopS2").WithId("PopS2"); _referenceSimulation = new PopulationSimulation().WithName("PopS3").WithId("PopS3"); _populationSimulationComparison = new PopulationSimulationComparison { Name = "PopulationComparison", Description = "PopulationComparison Description", }; _populationSimulationAnalysis = new BoxWhiskerAnalysisChart(); _populationSimulationComparison.AddSimulation(_populationSimulation1); _populationSimulationComparison.AddSimulation(_populationSimulation2); _populationSimulationComparison.AddAnalysis(_populationSimulationAnalysis); _populationSimulationComparison.ReferenceGroupingItem = new GroupingItem(); _populationSimulationComparison.ReferenceSimulation = _referenceSimulation; _curveChart = new CurveChart(); A.CallTo(() => _individualSimulationComparisonMapper.MapToSnapshot(_individualSimulationComparison)).Returns(_curveChart); _populationAnalysisChartSnapshot = new Snapshots.PopulationAnalysisChart(); A.CallTo(() => _populationAnalysisChartMapper.MapToSnapshot(_populationSimulationAnalysis)).Returns(_populationAnalysisChartSnapshot); _project = new PKSimProject(); _project.AddBuildingBlock(_individualSimulation1); _project.AddBuildingBlock(_individualSimulation2); _project.AddBuildingBlock(_populationSimulation1); _project.AddBuildingBlock(_populationSimulation2); _project.AddBuildingBlock(_referenceSimulation); _snapshotContext = new SnapshotContext(_project, ProjectVersions.V10); return(_completed); }
protected override void Context() { _projectRetriever = A.Fake <IPKSimProjectRetriever>(); sut = new BuildingBlockRepository(_projectRetriever); _project = new PKSimProject(); A.CallTo(() => _projectRetriever.Current).Returns(_project); _individual1 = new Individual().WithName("IND1"); _individual2 = new Individual().WithName("IND2"); _project.AddBuildingBlock(_individual1); _project.AddBuildingBlock(_individual2); }
public override void GlobalContext() { base.GlobalContext(); var moleculeExpressionTask = IoC.Resolve <IMoleculeExpressionTask <Individual> >(); _templateIndividual = DomainFactoryForSpecs.CreateStandardIndividual(); _templateExpressionProfileCYP3A4 = DomainFactoryForSpecs.CreateExpressionProfile <IndividualEnzyme>("CYP3A4"); moleculeExpressionTask.AddExpressionProfile(_templateIndividual, _templateExpressionProfileCYP3A4); _templateIndividualUsingSameProfile = DomainFactoryForSpecs.CreateStandardIndividual().WithName("IND2"); moleculeExpressionTask.AddExpressionProfile(_templateIndividualUsingSameProfile, _templateExpressionProfileCYP3A4); _templateIndividualUsingAnotherProfile = DomainFactoryForSpecs.CreateStandardIndividual().WithName("IND3"); _templateExpressionProfileCYP2D6 = DomainFactoryForSpecs.CreateExpressionProfile <IndividualEnzyme>("CYP2D6"); moleculeExpressionTask.AddExpressionProfile(_templateIndividualUsingAnotherProfile, _templateExpressionProfileCYP2D6); var compound = DomainFactoryForSpecs.CreateStandardCompound(); var protocol = DomainFactoryForSpecs.CreateStandardIVBolusProtocol(); _simulation = DomainFactoryForSpecs.CreateSimulationWith(_templateIndividual, compound, protocol) as IndividualSimulation; var project = new PKSimProject(); project.AddBuildingBlock(compound); project.AddBuildingBlock(protocol); project.AddBuildingBlock(_simulation); project.AddBuildingBlock(_templateIndividual); project.AddBuildingBlock(_templateIndividualUsingSameProfile); project.AddBuildingBlock(_templateIndividualUsingAnotherProfile); project.AddBuildingBlock(_templateExpressionProfileCYP3A4); project.AddBuildingBlock(_templateExpressionProfileCYP2D6); var workspace = IoC.Resolve <ICoreWorkspace>(); workspace.Project = project; }
protected override void Context() { _project = new PKSimProject(); _projectRetriever = A.Fake <IPKSimProjectRetriever>(); _transporterContainerTemplateRepository = A.Fake <ITransporterContainerTemplateRepository>(); A.CallTo(() => _projectRetriever.Current).Returns(_project); _compound1 = A.Fake <Compound>(); _compound1.IsLoaded = false; _compound2 = new Compound { IsLoaded = true }; _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "ProjA", Name = "P1" }); _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "ProjC", Name = "P2" }); _compound2.AddProcess(new EnzymaticProcess { MoleculeName = "ProjB", Name = "P3" }); _ontogenyRepository = A.Fake <IOntogenyRepository>(); _moleculeParameterRepository = A.Fake <IMoleculeParameterRepository>(); _expressionProfile = A.Fake <ExpressionProfile>(); _expressionProfile.IsLoaded = true; A.CallTo(() => _expressionProfile.MoleculeName).Returns("ProjE"); _project.AddBuildingBlock(_compound1); _project.AddBuildingBlock(_compound2); _project.AddBuildingBlock(_expressionProfile); sut = new UsedMoleculeRepository(_projectRetriever, _ontogenyRepository, _moleculeParameterRepository, _transporterContainerTemplateRepository); var molParam1 = new MoleculeParameter { MoleculeName = "DbB" }; var molParam2 = new MoleculeParameter { MoleculeName = "DbA" }; A.CallTo(() => _moleculeParameterRepository.All()).Returns(new[] { molParam1, molParam2 }); A.CallTo(() => _transporterContainerTemplateRepository.AllTransporterNames).Returns(new[] { "ATRANS1", "TRANS2" }); A.CallTo(() => _ontogenyRepository.AllFor(CoreConstants.Species.HUMAN)).Returns(new[] { new DatabaseOntogeny { Name = "OntoC" } }); }
public IPKSimProject MapFrom(ProjectMetaData projectMetaData) { var project = new PKSimProject { Name = projectMetaData.Name, Description = projectMetaData.Description }; //Observed data needs to be loaded first into project projectMetaData.AllObservedData.Each(x => project.AddObservedData(mapFrom(x))); projectMetaData.BuildingBlocks.Each(x => project.AddBuildingBlock(mapFrom(x))); //we need a shared context for all object referencing observed data and simulations using (var context = _serializationContextFactory.Create(project.AllObservedData, project.All <ISimulation>())) { var localContext = context; projectMetaData.ParameterIdentifications.Each(x => project.AddParameterIdentification(mapFrom(x, localContext))); projectMetaData.SensitivityAnalyses.Each(x => project.AddSensitivityAnalysis(mapFrom(x, localContext))); } projectMetaData.SimulationComparisons.Each(x => project.AddSimulationComparison(mapFrom(x))); //Once reference to dynamic meta data was added, deserialize the project itself _serializationManager.Deserialize(project, projectMetaData.Content.Data); //if the project DB Version is the same as the current project, the project did not change if (projectMetaData.Version == ProjectVersions.Current) { project.HasChanged = false; } return(project); }
public override Task GlobalContext() { _project = new PKSimProject(); _dialogCreator = A.Fake <IDialogCreator>(); _workspace = A.Fake <IWorkspace>(); _executionContext = A.Fake <IExecutionContext>(); _applicationController = A.Fake <IApplicationController>(); _workspaceLayoutUpdater = A.Fake <IWorkspaceLayoutUpdater>(); _userSettings = A.Fake <IUserSettings>(); _journalTask = A.Fake <IJournalTask>(); _journalRetriever = A.Fake <IJournalRetriever>(); _snapshotTask = A.Fake <ISnapshotTask>(); _buildingBlockInSimulationManager = A.Fake <IBuildingBlockInSimulationManager>(); _workspace.Project = _project; _workspace.WorkspaceLayout = new WorkspaceLayout(); _heavyWorkManager = new HeavyWorkManagerForSpecs(); _simulation = new IndividualSimulation(); _project.AddBuildingBlock(_simulation); sut = new ProjectTask(_workspace, _applicationController, _dialogCreator, _executionContext, _heavyWorkManager, _workspaceLayoutUpdater, _userSettings, _journalTask, _journalRetriever, _snapshotTask, _buildingBlockInSimulationManager); _oldFileExitst = FileHelper.FileExists; return(_completed); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _eventMappingFactory = A.Fake <IEventMappingFactory>(); sut = new EventMappingMapper(_parameterMapper, _eventMappingFactory); _event = new PKSimEvent() .WithName("E1") .WithId("EventId"); _eventMapping = new EventMapping { TemplateEventId = _event.Id, StartTime = DomainHelperForSpecs.ConstantParameterWithValue(1) }; _snapshotEventStartTime1 = new Parameter { Name = "P1" }; _project = new PKSimProject(); _project.AddBuildingBlock(_event); A.CallTo(() => _parameterMapper.MapToSnapshot(_eventMapping.StartTime)).Returns(_snapshotEventStartTime1); return(_completed); }
public override void GlobalContext() { base.GlobalContext(); _templateIndividual = DomainFactoryForSpecs.CreateStandardIndividual(); var compound = DomainFactoryForSpecs.CreateStandardCompound(); var protocol = DomainFactoryForSpecs.CreateStandardIVBolusProtocol(); _simulation = DomainFactoryForSpecs.CreateSimulationWith(_templateIndividual, compound, protocol) as IndividualSimulation; _workspace = IoC.Resolve <IWorkspace>(); var project = new PKSimProject(); project.AddBuildingBlock(compound); project.AddBuildingBlock(protocol); project.AddBuildingBlock(_simulation); project.AddBuildingBlock(_templateIndividual); _workspace.Project = project; }
protected override Task Context() { _parameterIdentificationConfigurationMapper = A.Fake <ParameterIdentificationConfigurationMapper>(); _outputMappingMapper = A.Fake <OutputMappingMapper>(); _identificationParameterMapper = A.Fake <IdentificationParameterMapper>(); _parameterIdentificationAnalysisMapper = A.Fake <ParameterIdentificationAnalysisMapper>(); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _logger = A.Fake <IOSPSuiteLogger>(); _project = new PKSimProject(); _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current); _simulation = new IndividualSimulation().WithName("S1"); _project.AddBuildingBlock(_simulation); _parameterIdentification = new ModelParameterIdentification(); _snapshotParameterIndentificationConfiguration = new ParameterIdentificationConfiguration(); _snapshotOutputMapping = new Snapshots.OutputMapping(); _outputMapping = new OutputMapping(); _parameterIdentification.AddSimulation(_simulation); _parameterIdentification.AddOutputMapping(_outputMapping); _identificationParameter = new IdentificationParameter { Name = "IP" }; _parameterIdentification.AddIdentificationParameter(_identificationParameter); _snapshotIdentificationParameter = new Snapshots.IdentificationParameter(); _snapshotParameterIdentificationAnalysis = new ParameterIdentificationAnalysis(); _parameterIdentificationAnalysis = A.Fake <ISimulationAnalysis>(); _parameterIdentification.AddAnalysis(_parameterIdentificationAnalysis); sut = new ParameterIdentificationMapper( _parameterIdentificationConfigurationMapper, _outputMappingMapper, _identificationParameterMapper, _parameterIdentificationAnalysisMapper, _objectBaseFactory, _logger ); A.CallTo(() => _parameterIdentificationConfigurationMapper.MapToSnapshot(_parameterIdentification.Configuration)).Returns(_snapshotParameterIndentificationConfiguration); A.CallTo(() => _outputMappingMapper.MapToSnapshot(_outputMapping)).Returns(_snapshotOutputMapping); A.CallTo(() => _identificationParameterMapper.MapToSnapshot(_identificationParameter)).Returns(_snapshotIdentificationParameter); A.CallTo(() => _parameterIdentificationAnalysisMapper.MapToSnapshot(_parameterIdentificationAnalysis)).Returns(_snapshotParameterIdentificationAnalysis); return(_completed); }
protected override void Context() { _context = A.Fake <IExecutionContext>(); _oldSimulation = new IndividualSimulation().WithName("Old"); _newSimulation = new IndividualSimulation().WithName("New"); _project = new PKSimProject(); _simulationDifferenceBuilder = A.Fake <ISimulationCommandDescriptionBuilder>(); _simulationReferenceUpdater = A.Fake <ISimulationReferenceUpdater>(); A.CallTo(() => _context.CurrentProject).Returns(_project); A.CallTo(() => _context.Resolve <ISimulationCommandDescriptionBuilder>()).Returns(_simulationDifferenceBuilder); A.CallTo(() => _context.Resolve <ISimulationReferenceUpdater>()).Returns(_simulationReferenceUpdater); var reportPart = new ReportPart(); reportPart.AddToContent("toto"); A.CallTo(() => _simulationDifferenceBuilder.BuildDifferenceBetween(_oldSimulation, _newSimulation)).Returns(reportPart); sut = new SwapSimulationCommand(_oldSimulation, _newSimulation, _context); _project.AddBuildingBlock(_oldSimulation); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _identificationParameterFactory = A.Fake <IIdentificationParameterFactory>(); _logger = A.Fake <IOSPSuiteLogger>(); _identificationParameterTask = A.Fake <IIdentificationParameterTask>(); sut = new IdentificationParameterMapper(_parameterMapper, _identificationParameterFactory, _identificationParameterTask, _logger); _identificationParameter = new IdentificationParameter { IsFixed = true, UseAsFactor = true, Scaling = Scalings.Linear }; _startValueParameter = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_VALUE); _identificationParameter.Add(_startValueParameter); _identificationParameter.Name = "PARAM"; _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1"); _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2"); _simulation = A.Fake <Simulation>().WithName("S"); _simulation.Model.Root = new Container { _parameter1, _parameter2 }; _identificationParameter.Scaling = Scalings.Linear; _parameterSelection1 = new ParameterSelection(_simulation, _parameter1.Name); _parameterSelection2 = new ParameterSelection(_simulation, _parameter2.Name); _identificationParameter.AddLinkedParameter(_parameterSelection1); _identificationParameter.AddLinkedParameter(_parameterSelection2); _snapshotStartValueParameter = new Parameter(); A.CallTo(() => _parameterMapper.MapToSnapshot(_startValueParameter)).Returns(_snapshotStartValueParameter); _project = new PKSimProject(); _project.AddBuildingBlock(_simulation); _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current); _parameterIdentification = new ParameterIdentification(); _parameterIdentificationContext = new ParameterIdentificationContext(_parameterIdentification, _snapshotContext); return(_completed); }
protected override void Context() { _executionContext = A.Fake <IExecutionContext>(); _project = new PKSimProject(); A.CallTo(() => _executionContext.CurrentProject).Returns(_project); _compound = new Compound().WithId("Tralala").WithName("Tralala"); _project.AddBuildingBlock(_compound); _proc = new EnzymaticProcess().WithName("ActProc1"); var serializedStream = new byte[1]; A.CallTo(() => _executionContext.Serialize(_proc)).Returns(serializedStream); A.CallTo(() => _executionContext.Deserialize <CompoundProcess>(serializedStream)).Returns(_proc); A.CallTo(() => _executionContext.Get <Compound>(_compound.Id)).Returns(_compound); A.CallTo(() => _executionContext.Get <CompoundProcess>(_proc.Id)).Returns(_proc); sut = new AddProcessToCompoundCommand(_proc, _compound, _executionContext); }
public override void GlobalContext() { base.GlobalContext(); _sim1 = new IndividualSimulation { Id = "Sim1", Name = "Sim1", IsLoaded = true, Model = new Model { Root = new Container() } }; _sim1.Model.Root.Add(new Container { new Parameter().WithName("P") }.WithName("Liver")); var objectBaseRepository = IoC.Resolve <IWithIdRepository>(); var workspace = IoC.Resolve <IWorkspace>(); _project = IoC.Resolve <PKSimProject>(); workspace.Project = _project; objectBaseRepository.Register(_sim1); _project.AddBuildingBlock(_sim1); _sensitivityAnalysis = new SensitivityAnalysis { Name = "SA", Simulation = _sim1 }; _sensitivityParameter1 = DomainHelperForSpecs.SensitivityParameter(range: 0.5d, steps: 5); _parameterSelection1 = new ParameterSelection(_sim1, new QuantitySelection("Liver|P", QuantityType.Parameter)); _sensitivityParameter1.ParameterSelection = _parameterSelection1; _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter1); _deserializedSensitivityAnalysis = SerializeAndDeserialize(_sensitivityAnalysis); }
public override void GlobalContext() { base.GlobalContext(); _observedData = DomainHelperForSpecs.ObservedData(); _sim1 = new IndividualSimulation { Id = "Sim1", Name = "Sim1", IsLoaded = true, Model = new Model { Root = new Container() } }; _sim1.Model.Root.Add(new Container { new Parameter().WithName("P") }.WithName("Liver")); _sim2 = new IndividualSimulation { Id = "Sim2", Name = "Sim2", IsLoaded = true, Model = new Model { Root = new Container() } }; _sim2.Model.Root.Add(new Container { new Parameter().WithName("P") }.WithName("Liver")); _objectBaseRepository = IoC.Resolve <IWithIdRepository>(); var workspace = IoC.Resolve <ICoreWorkspace>(); _project = IoC.Resolve <PKSimProject>(); workspace.Project = _project; _objectBaseRepository.Register(_sim1); _objectBaseRepository.Register(_sim2); _project.AddObservedData(_observedData); _project.AddBuildingBlock(_sim1); _project.AddBuildingBlock(_sim2); _parameterIdentification = new ParameterIdentification(); _parameterIdentification.AddSimulation(_sim1); _parameterIdentification.AddSimulation(_sim2); _outputMapping = new OutputMapping { WeightedObservedData = new WeightedObservedData(_observedData), OutputSelection = new SimulationQuantitySelection(_sim1, new QuantitySelection("A|B", QuantityType.Metabolite)), Weight = 5, Scaling = Scalings.Log }; _outputMapping.WeightedObservedData.Weights[1] = 10; _parameterIdentification.AddOutputMapping(_outputMapping); _identificationParameter = DomainHelperForSpecs.IdentificationParameter(min: 1, max: 10, startValue: 5); _parameterSelection1 = new ParameterSelection(_sim1, new QuantitySelection("Liver|P", QuantityType.Parameter)); _parameterSelection2 = new ParameterSelection(_sim2, new QuantitySelection("Liver|P", QuantityType.Parameter)); _identificationParameter.AddLinkedParameter(_parameterSelection1); _identificationParameter.AddLinkedParameter(_parameterSelection2); _parameterIdentification.AddIdentificationParameter(_identificationParameter); _identificationParameter.Scaling = Scalings.Linear; _parameterIdentification.Configuration.AlgorithmProperties = new OptimizationAlgorithmProperties("AA"); _parameterIdentification.AlgorithmProperties.Add(new ExtendedProperty <double> { Name = "Toto", Value = 5 }); _runResult = new ParameterIdentificationRunResult(); _parameterIdentification.AddResult(_runResult); _parameterIdentification.AddAnalysis(new ParameterIdentificationPredictedVsObservedChart()); _parameterIdentification.AddAnalysis(new ParameterIdentificationTimeProfileChart()); _parameterIdentification.AddAnalysis(new ParameterIdentificationResidualHistogram()); _parameterIdentification.AddAnalysis(new ParameterIdentificationResidualVsTimeChart()); GlobalBecause(); }
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); }
protected override void Context() { _view = A.Fake <IBuildingBlockExplorerView>(); A.CallTo(() => _view.TreeView).Returns(A.Fake <IUxTreeView>()); _regionResolver = A.Fake <IRegionResolver>(); _region = A.Fake <IRegion>(); A.CallTo(() => _regionResolver.RegionWithName(RegionNames.BuildingBlockExplorer)).Returns(_region); _project = new PKSimProject(); var compound = new Compound().WithName("compound"); _individual = new Individual().WithName("individual"); _individual.OriginData = new OriginData { Species = new Species() }; _project.AddBuildingBlock(_individual); _project.AddBuildingBlock(compound); _observedDataInExplorerPresenter = A.Fake <IObservedDataInExplorerPresenter>(); _buildingBlockIconRetriever = A.Fake <IBuildingBlockIconRetriever>(); _treeNodeFactory = A.Fake <ITreeNodeFactory>(); _contextMenuFactory = A.Fake <ITreeNodeContextMenuFactory>(); _buildingBlockTask = A.Fake <IBuildingBlockTask>(); _toolTipCreator = A.Fake <IToolTipPartCreator>(); _projectRetriever = A.Fake <IProjectRetriever>(); _classificationPresenter = A.Fake <IClassificationPresenter>(); _multipleTreeNodeContextMenuFactory = A.Fake <IMultipleTreeNodeContextMenuFactory>(); sut = new BuildingBlockExplorerPresenter(_view, _treeNodeFactory, _contextMenuFactory, _multipleTreeNodeContextMenuFactory, _buildingBlockIconRetriever, _regionResolver, _buildingBlockTask, _toolTipCreator, _projectRetriever, _classificationPresenter, _observedDataInExplorerPresenter); _compoundFolderNode = new RootNode(PKSimRootNodeTypes.CompoundFolder); _individualFolderNode = new RootNode(PKSimRootNodeTypes.IndividualFolder); _formulationFolderNode = new RootNode(PKSimRootNodeTypes.FormulationFolder); _protocolFolderNode = new RootNode(PKSimRootNodeTypes.ProtocolFolder); _observersFolderNode = new RootNode(PKSimRootNodeTypes.ObserverSetFolder); _populationFolderNode = new RootNode(PKSimRootNodeTypes.PopulationFolder); _eventRootNode = new RootNode(PKSimRootNodeTypes.EventFolder); _simulationNode = new SimulationNode(new ClassifiableSimulation { Subject = new IndividualSimulation { Id = "1" } }); _compoundNode = new ObjectWithIdAndNameNode <Compound>(compound); _individualNode = new ObjectWithIdAndNameNode <Individual>(_individual); _observationRootNode = new RootNode(RootNodeTypes.ObservedDataFolder); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.CompoundFolder)).Returns(_compoundFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.IndividualFolder)).Returns(_individualFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.ProtocolFolder)).Returns(_protocolFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.ObserverSetFolder)).Returns(_observersFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.FormulationFolder)).Returns(_formulationFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.PopulationFolder)).Returns(_populationFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(RootNodeTypes.ObservedDataFolder)).Returns(_observationRootNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.EventFolder)).Returns(_eventRootNode); A.CallTo(() => _treeNodeFactory.CreateFor(_individual)).Returns(_individualNode); A.CallTo(() => _treeNodeFactory.CreateFor(compound)).Returns(_compoundNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.CompoundFolder.Id)).Returns(_compoundFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.IndividualFolder.Id)).Returns(_individualFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.ProtocolFolder.Id)).Returns(_protocolFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.ObserverSetFolder.Id)).Returns(_observersFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.FormulationFolder.Id)).Returns(_formulationFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.PopulationFolder.Id)).Returns(_populationFolderNode); A.CallTo(() => _view.TreeView.NodeById(RootNodeTypes.ObservedDataFolder.Id)).Returns(_observationRootNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.EventFolder.Id)).Returns(_eventRootNode); A.CallTo(() => _view.AddNode(A <ITreeNode> ._)).ReturnsLazily(s => s.Arguments[0].DowncastTo <ITreeNode>()); }
protected override Task Context() { _classificationMapper = A.Fake <ClassificationMapper>(); _snapshotMapper = A.Fake <ISnapshotMapper>(); _executionContext = A.Fake <IExecutionContext>(); _lazyLoadTask = A.Fake <ILazyLoadTask>(); _simulationMapper = A.Fake <SimulationMapper>(); _simulationComparisonMapper = A.Fake <SimulationComparisonMapper>(); _parameterIdentificationMapper = A.Fake <ParameterIdentificationMapper>(); _classificationSnapshotTask = A.Fake <IClassificationSnapshotTask>(); _qualificationPlanMapper = A.Fake <QualificationPlanMapper>(); _creationMetaDataFactory = A.Fake <ICreationMetaDataFactory>(); _logger = A.Fake <ILogger>(); sut = new ProjectMapper( _simulationMapper, _simulationComparisonMapper, _parameterIdentificationMapper, _qualificationPlanMapper, _executionContext, _classificationSnapshotTask, _lazyLoadTask, _creationMetaDataFactory, _logger); A.CallTo(() => _executionContext.Resolve <ISnapshotMapper>()).Returns(_snapshotMapper); _individual = new Individual().WithName("IND"); _compound = new Compound().WithName("COMP"); _event = new PKSimEvent().WithName("EVENT"); _formulation = new Formulation().WithName("FORM"); _protocol = new SimpleProtocol().WithName("PROTO"); _population = new RandomPopulation().WithName("POP"); _observedData = new DataRepository().WithName("OD"); _parameterIdentification = new OSPSuite.Core.Domain.ParameterIdentifications.ParameterIdentification().WithName("PI").WithId("PI_ID"); _classifiableObservedData = new ClassifiableObservedData { Subject = _observedData }; _classification = new Classification { ClassificationType = ClassificationType.ObservedData }.WithName("OD Classification"); _simulationComparison = new IndividualSimulationComparison().WithName("COMP").WithId("SimComp"); _simulation = new IndividualSimulation().WithName("IND_SIM").WithId("IndSim"); _qualificationPlan = new QualificationPlan().WithName("QP").WithId("QP_ID"); _project = new PKSimProject(); _project.AddBuildingBlock(_individual); _project.AddBuildingBlock(_compound); _project.AddBuildingBlock(_event); _project.AddBuildingBlock(_formulation); _project.AddBuildingBlock(_protocol); _project.AddBuildingBlock(_population); _project.AddObservedData(_observedData); _project.AddBuildingBlock(_simulation); _project.AddClassifiable(_classifiableObservedData); _project.AddClassification(_classification); _project.AddSimulationComparison(_simulationComparison); _project.AddParameterIdentification(_parameterIdentification); _project.AddQualificationPlan(_qualificationPlan); _compoundSnapshot = new Snapshots.Compound(); _individualSnapshot = new Snapshots.Individual(); _eventSnapshot = new Event(); _formulationSnapshot = new Snapshots.Formulation(); _protocolSnapshot = new Snapshots.Protocol(); _populationSnapshot = new Snapshots.Population(); _observedDataSnapshot = new Snapshots.DataRepository(); _parameterIdentificationSnapshot = new ParameterIdentification(); _observedDataClassificationSnapshot = new Snapshots.Classification(); _simulationComparisonSnapshot = new SimulationComparison(); _simulationClassificationSnapshot = new Snapshots.Classification(); _comparisonClassificationSnapshot = new Snapshots.Classification(); _parameterIdentificationClassificationSnapshot = new Snapshots.Classification(); _qualificationPlanClassificationSnapshot = new Snapshots.Classification(); _qualificationPlanSnapshot = new Snapshots.QualificationPlan(); _simulationSnapshot = new Simulation(); A.CallTo(() => _snapshotMapper.MapToSnapshot(_compound)).Returns(_compoundSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_individual)).Returns(_individualSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_event)).Returns(_eventSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_formulation)).Returns(_formulationSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_protocol)).Returns(_protocolSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_population)).Returns(_populationSnapshot); A.CallTo(() => _snapshotMapper.MapToSnapshot(_observedData)).Returns(_observedDataSnapshot); A.CallTo(() => _simulationMapper.MapToSnapshot(_simulation, _project)).Returns(_simulationSnapshot); A.CallTo(() => _simulationComparisonMapper.MapToSnapshot(_simulationComparison)).Returns(_simulationComparisonSnapshot); A.CallTo(() => _parameterIdentificationMapper.MapToSnapshot(_parameterIdentification, _project)).Returns(_parameterIdentificationSnapshot); A.CallTo(() => _qualificationPlanMapper.MapToSnapshot(_qualificationPlan)).Returns(_qualificationPlanSnapshot); A.CallTo(() => _classificationSnapshotTask.MapClassificationsToSnapshots <ClassifiableObservedData>(_project)).Returns(new[] { _observedDataClassificationSnapshot }); A.CallTo(() => _classificationSnapshotTask.MapClassificationsToSnapshots <ClassifiableSimulation>(_project)).Returns(new[] { _simulationClassificationSnapshot }); A.CallTo(() => _classificationSnapshotTask.MapClassificationsToSnapshots <ClassifiableComparison>(_project)).Returns(new[] { _comparisonClassificationSnapshot }); A.CallTo(() => _classificationSnapshotTask.MapClassificationsToSnapshots <ClassifiableParameterIdentification>(_project)).Returns(new[] { _parameterIdentificationClassificationSnapshot }); A.CallTo(() => _classificationSnapshotTask.MapClassificationsToSnapshots <ClassifiableQualificationPlan>(_project)).Returns(new[] { _qualificationPlanClassificationSnapshot }); return(_completed); }
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); _compoundGroupSelectionOneAlternative = new CompoundGroupSelection { AlternativeName = "ALT1", GroupName = "ALTERNATIVE_GROUP_1" }; _compoundGroupSelectionTwoAlternatives = new CompoundGroupSelection { AlternativeName = "ALT2", GroupName = "ALTERNATIVE_GROUP_2" }; _compound = new Compound { Name = "COMP", }; _protocol = new SimpleProtocol { Name = "PROTOCOL" }; _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup { Name = _compoundGroupSelectionOneAlternative.GroupName }; _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup { Name = _compoundGroupSelectionTwoAlternatives.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(_compoundGroupSelectionOneAlternative); _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionTwoAlternatives); _compoundProperties.Compound = _compound; _enzymaticProcess = new EnzymaticProcess { Name = "EnzymaticProcess" }; _anotherEnzymaticProcess = new EnzymaticProcess { Name = "AnotherEnzymaticProcess", MoleculeName = "CYP3A4" }; _specificBindingProcess = new SpecificBindingPartialProcess { Name = "SpecificBinding" }; _gfrTransportProcess = new SystemicProcess { Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR }; _hepaticEnzymaticProcess = new SystemicProcess { Name = "Plasma Clearance", SystemicProcessType = SystemicProcessTypes.Hepatic }; _compound.AddProcess(_enzymaticProcess); _compound.AddProcess(_specificBindingProcess); _compound.AddProcess(_gfrTransportProcess); _compound.AddProcess(_hepaticEnzymaticProcess); _enzymaticPartialProcessSelection = new EnzymaticProcessSelection { ProcessName = _enzymaticProcess.Name }; _noEnzymaticSystemicProcessSelection = new SystemicProcessSelection { ProcessType = SystemicProcessTypes.Hepatic }; _specificBindingPartialProcessSelection = new ProcessSelection { ProcessName = _specificBindingProcess.Name }; _transportSystemicProcessSelection = new SystemicProcessSelection { ProcessName = _gfrTransportProcess.Name, ProcessType = _gfrTransportProcess.SystemicProcessType, }; _noEnzymaticPartialProcessSelection = new EnzymaticProcessSelection { MoleculeName = _anotherEnzymaticProcess.MoleculeName }; _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection); _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_noEnzymaticPartialProcessSelection); _compoundProperties.Processes.MetabolizationSelection.AddSystemicProcessSelection(_noEnzymaticSystemicProcessSelection); _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 }; _snapshotProcess4 = new CompoundProcessSelection { SystemicProcessType = _noEnzymaticSystemicProcessSelection.ProcessType.SystemicProcessTypeId.ToString() }; _snapshotProcess5 = new CompoundProcessSelection { MoleculeName = _noEnzymaticPartialProcessSelection.MoleculeName }; _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.MapToSnapshot(_noEnzymaticSystemicProcessSelection)).Returns(_snapshotProcess4); A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticPartialProcessSelection)).Returns(_snapshotProcess5); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, _enzymaticProcess)).Returns(_enzymaticPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, _specificBindingProcess)).Returns(_specificBindingPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, _gfrTransportProcess)).Returns(_transportSystemicProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess4, A <NotSelectedSystemicProcess> ._)).Returns(_noEnzymaticSystemicProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess5, A <EnzymaticProcess> ._)).Returns(_noEnzymaticPartialProcessSelection); return(_completed); }
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>(); _simulationComparisonTask = A.Fake <ISimulationComparisonTask>(); _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>().WithId("SimComp_Id"); 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, _simulationComparisonTask); A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project); }
public void should_add_the_new_simulation_to_the_project() { A.CallTo(() => _project.AddBuildingBlock(_newSimulation)).MustHaveHappened(); }