protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); // Adds an incorrect compound process selection _snapshot.Processes = new List <CompoundProcessSelection>(_snapshot.Processes) { new CompoundProcessSelection() }.ToArray(); _simulation = A.Fake <Simulation>(); _simulationSubject = A.Fake <ISimulationSubject>(); A.CallTo(() => _simulationSubject.MoleculeByName("CYP3A4")).Returns(new IndividualEnzyme { Name = "CYP3A4" }); A.CallTo(() => _simulation.BuildingBlock <ISimulationSubject>()).Returns(_simulationSubject); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new CompoundPropertiesContext(_project, _simulation); }
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); }
public IEventMapping MapFrom(EventMappingDTO eventMappingDTO, PKSim.Core.Model.Simulation simulation) { var templateEventId = eventMappingDTO.Event.Id; var templateEvent = _buildingBlockRepository.All().FindById(templateEventId); //in that case, event is a simulation event, we need to retrieve the template event if (templateEvent == null) { var usedEvent = simulation.UsedBuildingBlockById(templateEventId); templateEventId = usedEvent.TemplateId; } var eventMapping = eventMappingDTO.EventMapping; eventMapping.TemplateEventId = templateEventId; return(eventMapping); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new CompoundPropertiesContext(_project, _simulation); }
public EventMappingDTO MapFrom(IEventMapping eventMapping, PKSim.Core.Model.Simulation simulation) { var eventMappingDTO = new EventMappingDTO(eventMapping); eventMappingDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(eventMapping.StartTime, eventMappingDTO, x => x.StartTime, x => x.StartTimeParameter); var templateEvent = _buildingBlockRepository.All <PKSim.Core.Model.PKSimEvent>().FindById(eventMapping.TemplateEventId); var usedEvent = simulation.UsedBuildingBlockByTemplateId(eventMapping.TemplateEventId); //simulation was already using an event based on template. Retrieved the building block used if (usedEvent != null) { templateEvent = _buildingBlockInSimulationManager.TemplateBuildingBlockUsedBy <PKSim.Core.Model.PKSimEvent>(usedEvent); } eventMappingDTO.Event = templateEvent; return(eventMappingDTO); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new SnapshotContextWithSimulation(_simulation, _baseSnapshotContext); _snapshot.Alternatives[0].AlternativeName = "UNKNOWN"; }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); _simulationSubject = A.Fake <ISimulationSubject>(); A.CallTo(() => _simulationSubject.MoleculeByName("CYP3A4")).Returns(null); A.CallTo(() => _simulation.BuildingBlock <ISimulationSubject>()).Returns(_simulationSubject); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new SnapshotContextWithSimulation(_simulation, _baseSnapshotContext); }
public static void AddModelToSimulation(Simulation simulation) { var simModelConstructor = IoC.Resolve <ISimulationConstructor>(); simModelConstructor.AddModelToSimulation(simulation); }
public ClassifiableSimulation AddSimulationClassificationFor(Simulation simulation) { return(AddClassisificationFor <ClassifiableSimulation, Simulation>(simulation)); }
public void SelectDefaultOutputFor(Simulation simulation) { _simulationSettingsRetriever.CreatePKSimDefaults(simulation); }
public void RunSimulation(Simulation simulation) { var simnulationEngine = _simulationEngineFactory.Create <IndividualSimulation>(); simnulationEngine.Run(simulation.DowncastTo <IndividualSimulation>()); }
protected override void Context() { base.Context(); _activeSimulation = A.Fake <PKSim.Core.Model.Simulation>(); A.CallTo(() => _activeSubjectRetriever.Active <PKSim.Core.Model.Simulation>()).Returns(_activeSimulation); }