public static Simulation CreateSimulationWith(ISimulationSubject simulationSubject, Compound compound, Protocol protocol, Formulation formulation, bool allowAging = false) { var simulation = CreateModelLessSimulationWith(simulationSubject, compound, protocol, allowAging, formulation); AddModelToSimulation(simulation); return(simulation); }
protected override void Context() { base.Context(); _formulation = A.Fake <PKSim.Core.Model.Formulation>(); _formulationFlatContainer = new FlatContainer(); _formulationFlatContainer.Type = CoreConstants.ContainerType.Formulation; _formulationFlatContainer.Name = "tralal"; A.CallTo(() => _containerIdToFormulationMapper.MapFrom(_formulationFlatContainer)).Returns(_formulation); }
protected override void Context() { base.Context(); _formulation = new Formulation(); _formulation.FormulationType = "tralala"; _formulationInfo = new RepresentationInfo(); _para1 = A.Fake <IParameter>().WithName("Para1"); _para2 = A.Fake <IParameter>().WithName("Para2"); _formulation.Add(_para1); _formulation.Add(_para2); _formulationInfo.Description = " traaa"; _formulationInfo.DisplayName = "tutu"; A.CallTo(() => _representationInfoRepository.InfoFor(RepresentationObjectType.CONTAINER, _formulation.FormulationType)).Returns(_formulationInfo); }
public static Simulation CreateModelLessSimulationWith(ISimulationSubject simulationSubject, IReadOnlyList <Compound> compounds, IReadOnlyList <Protocol> protocols, ModelProperties modelProperties, bool allowAging = false, Formulation formulation = null) { var simModelConstructor = IoC.Resolve <ISimulationConstructor>(); var simulationConstruction = new SimulationConstruction { SimulationSubject = simulationSubject, TemplateCompounds = compounds, TemplateProtocols = protocols, ModelProperties = modelProperties, SimulationName = "simulation", TemplateFormulation = formulation, AllowAging = allowAging, }; return(simModelConstructor.CreateModelLessSimulationWith(simulationConstruction)); }
protected override void Because() { _formulation = sut.MapFrom(_formulationFlatContainer); }
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); }
public static Simulation CreateSimulationWith(ISimulationSubject simulationSubject, Compound compound, Protocol protocol, string modelName, Formulation formulation = null) { var simulation = createModelLessSimulationWith(simulationSubject, compound, protocol, modelName, formulation); AddModelToSimulation(simulation); return(simulation); }
public static Simulation CreateModelLessSimulationWith(ISimulationSubject simulationSubject, Compound compound, Protocol protocol, ModelProperties modelProperties, bool allowAging = false, Formulation formulation = null) { return(CreateModelLessSimulationWith(simulationSubject, new[] { compound }, new[] { protocol }, modelProperties, allowAging, formulation)); }
public static Simulation CreateModelLessSimulationWith(ISimulationSubject simulationSubject, IReadOnlyList <Compound> compounds, IReadOnlyList <Protocol> protocols, bool allowAging = false, Formulation formulation = null) { return(CreateModelLessSimulationWith(simulationSubject, compounds, protocols, CreateDefaultModelPropertiesFor(simulationSubject), allowAging, formulation)); }
public static Simulation CreateModelLessSimulationWith(ISimulationSubject simulationSubject, Compound compound, Protocol protocol, bool allowAging = false, Formulation formulation = null) { return(CreateModelLessSimulationWith(simulationSubject, compound, protocol, CreateDefaultModelPropertiesFor(simulationSubject), allowAging, formulation)); }
private static Simulation createModelLessSimulationWith(ISimulationSubject simulationSubject, Compound compound, Protocol protocol, string modelName, Formulation formulation = null) { return(CreateModelLessSimulationWith(simulationSubject, compound, protocol, CreateModelPropertiesFor(simulationSubject, modelName), false, formulation)); }
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); }
public FormulationCannotBeUsedForRouteException(Formulation formulation, string applicationRoute) : base(PKSimConstants.Error.FormulationCannotBeUsedWithRoute(formulation.Name, applicationRoute)) { }