protected override void Context()
        {
            _context = A.Fake <IExecutionContext>();
            var expressionProfile = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>();

            (_molecule, _)     = expressionProfile;
            _protein           = _molecule.DowncastTo <IndividualProtein>();
            _result            = new QueryExpressionResults(_expressionResults);
            _simulationSubject = A.Fake <ISimulationSubject>();
            sut = new EditIndividualMoleculeExpressionInSimulationSubjectFromQueryCommand(_molecule, _result, _simulationSubject);

            A.CallTo(() => _simulationSubject.AllExpressionParametersFor(_molecule)).Returns(_allExpressionParameters);
        }
        protected override void Context()
        {
            _parameter        = DomainHelperForSpecs.NormalDistributedParameter();
            _oldPercentile    = _parameter.Percentile;
            _parameter.Id     = "tralala";
            _executionContext = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.Get <IParameter>(_parameter.Id)).Returns(_parameter);
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
            _percentile             = 0.4;
            _parameter.IsFixedValue = true;

            sut = new SetParameterPercentileCommand(_parameter, _percentile);
        }
        protected override void Context()
        {
            base.Context();
            var para1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("para1").WithDimension(A.Fake <IDimension>());
            var para2 = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("para1").WithDimension(A.Fake <IDimension>());

            A.CallTo(() => _executionContext.BuildingBlockContaining(para1)).Returns(A.Fake <IPKSimBuildingBlock>());
            A.CallTo(() => _executionContext.BuildingBlockContaining(para2)).Returns(A.Fake <IPKSimBuildingBlock>());
            _parameters = new List <IParameter> {
                para1, para2
            };
            A.CallTo(() => _executionContext.Resolve <IParameterTask>()).Returns(sut);
        }
Exemplo n.º 4
0
        private void addPkAParameters(Model.Compound compound, int index, double pkA, CompoundType compoundType)
        {
            var pkaParameter = DomainHelperForSpecs.ConstantParameterWithValue(pkA).WithName(CoreConstants.Parameters.ParameterPKa(index));

            pkaParameter.ValueOrigin.UpdateFrom(_pkaValueOrigin);
            A.CallTo(() => _valueOriginMapper.MapToSnapshot(pkaParameter.ValueOrigin)).Returns(_snapshotValueOrigin);
            compound.Add(pkaParameter);
            var compoundTypeParameter = DomainHelperForSpecs.ConstantParameterWithValue((int)compoundType).WithName(Constants.Parameters.ParameterCompoundType(index));

            compoundTypeParameter.ValueOrigin.UpdateFrom(_pkaValueOrigin);
            A.CallTo(() => _valueOriginMapper.MapToSnapshot(compoundTypeParameter.ValueOrigin)).Returns(_snapshotValueOrigin);
            compound.Add(compoundTypeParameter);
        }
Exemplo n.º 5
0
        protected override void Context()
        {
            _molecule = new IndividualEnzyme
            {
                DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.ONTOGENY_FACTOR),
                DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.ONTOGENY_FACTOR_GI)
            };

            _ontogeny           = new DatabaseOntogeny();
            _ontogenyRepository = A.Fake <IOntogenyRepository>();
            _entityPathResolver = new EntityPathResolverForSpecs();
            sut = new MoleculeOntogenyVariabilityUpdater(_ontogenyRepository, _entityPathResolver);
        }
Exemplo n.º 6
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_curve);

            _anotherRepository          = DomainHelperForSpecs.ObservedData();
            _y2Column                   = _anotherRepository.AllButBaseGrid().First();
            _y2Column.QuantityInfo.Path = new[] { "D", "E", "F" };
            _context = new SimulationAnalysisContext(new[] { _dataRepository, _anotherRepository, }, new SnapshotContext());
            _snapshot.CurveOptions.Color = Color.Aqua;
            _snapshot.X = _y2Column.PathAsString;
        }
        protected override async Task Context()
        {
            await base.Context();

            _individualParameter                       = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("IndParam");
            _individualParameterTemplate               = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("IndParam");
            _individualParameter.BuildingBlockType     = PKSimBuildingBlockType.Individual;
            _individualParameter.Origin.BuilingBlockId = _individual.Id;
            _individualParameter.Origin.ParameterId    = "IndParamTemplateId";

            _individualParameterChanged                       = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("IndParamChanged");
            _individualParameterChangedTemplate               = DomainHelperForSpecs.ConstantParameterWithValue(10000).WithName("IndParamChanged");
            _individualParameterChanged.BuildingBlockType     = PKSimBuildingBlockType.Individual;
            _individualParameterChanged.Origin.BuilingBlockId = _individual.Id;
            _individualParameterChanged.Origin.ParameterId    = "IndParamChangedTemplateId";

            _simulationParameter = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("SimParam");
            _simulationParameter.BuildingBlockType = PKSimBuildingBlockType.Simulation;

            _protocolParameter = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("ProtocolParam");
            _protocolParameter.BuildingBlockType     = PKSimBuildingBlockType.Protocol;
            _protocolParameter.Origin.BuilingBlockId = _protocol.Id;
            _protocolParameter.Origin.ParameterId    = "ProtocolParamTemplateId";

            _rootContainer.Add(_individualParameter);
            _rootContainer.Add(_individualParameterChanged);
            _rootContainer.Add(_simulationParameter);
            _rootContainer.Add(_protocolParameter);

            _localizedParameters = new[] { _individualChangedParameterSnapshot, _simulationParameterSnapshot, _protocolParameterSnapshot };

            A.CallTo(() => _parameterMapper.LocalizedParametersFrom(A <IEnumerable <IParameter> > .That.Matches(x => x.ContainsAll(new[] { _individualParameterChanged, _simulationParameter, _protocolParameter }))))
            .Returns(_localizedParameters);

            A.CallTo(() => _executionContext.Get <IParameter>(_individualParameterChanged.Origin.ParameterId)).Returns(_individualParameterChangedTemplate);
            A.CallTo(() => _executionContext.Get <IParameter>(_individualParameter.Origin.ParameterId)).Returns(_individualParameterTemplate);

            _protocolTemplateBuildingBlock = new SimpleProtocol {
                Id = "ProtTemplateId"
            };
            _project.AddBuildingBlock(_protocolTemplateBuildingBlock);

            var allIndividualTemplateParameters = new PathCacheForSpecs <IParameter>();

            A.CallTo(() => _containerTask.CacheAllChildren <IParameter>(_individual)).Returns(allIndividualTemplateParameters);
            allIndividualTemplateParameters.Add(_individualParameterTemplate.Name, _individualParameterTemplate);
            allIndividualTemplateParameters.Add(_individualParameterChangedTemplate.Name, _individualParameterChangedTemplate);

            A.CallTo(() => _entityPathResolver.PathFor(_individualParameterTemplate)).Returns(_individualParameterTemplate.Name);
            A.CallTo(() => _entityPathResolver.PathFor(_individualParameterChangedTemplate)).Returns(_individualParameterChangedTemplate.Name);
        }
Exemplo n.º 8
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_dataRepository);

            _baseGrid            = new BaseGrid("baseGrid", DomainHelperForSpecs.TimeDimensionForSpecs());
            _mappedDataColumn    = new DataColumn("DataColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedRelatedColumn = new DataColumn("RelatedColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedDataColumn.AddRelatedColumn(_mappedRelatedColumn);

            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.BaseGrid, A <SnapshotContextWithDataRepository> ._)).Returns(_baseGrid);
            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.Columns.First(), A <SnapshotContextWithDataRepository> ._)).Returns(_mappedDataColumn);
        }
Exemplo n.º 9
0
 protected override void Context()
 {
     _formulaTypeMapper  = A.Fake <IParameterToFomulaTypeMapper>();
     _executionContext   = A.Fake <IExecutionContext>();
     _entityPathResolver = A.Fake <IEntityPathResolver>();
     _favoriteTask       = A.Fake <IFavoriteTask>();
     _parameterTask      = new ParameterTask(_entityPathResolver, _executionContext, _favoriteTask);
     sut = new ParameterUpdater(_formulaTypeMapper, _parameterTask);
     _sourceParameter = DomainHelperForSpecs.ConstantParameterWithValue(0);
     _sourceParameter.BuildingBlockType = PKSimBuildingBlockType.Individual;
     _targetParameter = DomainHelperForSpecs.ConstantParameterWithValue(1);
     _targetParameter.BuildingBlockType = PKSimBuildingBlockType.Individual;
     A.CallTo(() => _executionContext.BuildingBlockContaining(_targetParameter)).Returns(A.Fake <IPKSimBuildingBlock>());
 }
Exemplo n.º 10
0
        protected override Task Context()
        {
            _descriptorConditionMapper = A.Fake <DescriptorConditionMapper>();
            _explicitFormulaMapper     = A.Fake <ExplicitFormulaMapper>();
            _moleculeListMapper        = A.Fake <MoleculeListMapper>();
            _objectBaseFactory         = A.Fake <IObjectBaseFactory>();
            _dimensionRepository       = A.Fake <IDimensionRepository>();
            _logger = A.Fake <ILogger>();

            _dimension = DomainHelperForSpecs.TimeDimensionForSpecs();

            _amountObserver = new AmountObserverBuilder {
                Dimension = _dimension
            };
            _containerObserver = new ContainerObserverBuilder {
                Dimension = _dimension
            };
            _formula = new OSPSuite.Core.Domain.Formulas.ExplicitFormula("1+2");
            _amountObserver.Formula    = _formula;
            _containerObserver.Formula = _formula;

            _moleculeListSnapshot = new MoleculeList();
            _snapshotFormula      = new ExplicitFormula();

            _newMoleculeList = new OSPSuite.Core.Domain.Builder.MoleculeList();
            _newMoleculeList.AddMoleculeNameToExclude("A");
            _newMoleculeList.AddMoleculeName("B");
            _newMoleculeList.ForAll = false;
            _newFormula             = new OSPSuite.Core.Domain.Formulas.ExplicitFormula("New");

            sut = new ObserverMapper(
                _descriptorConditionMapper,
                _explicitFormulaMapper,
                _moleculeListMapper,
                _objectBaseFactory,
                _dimensionRepository,
                _logger);

            A.CallTo(() => _explicitFormulaMapper.MapToSnapshot(_formula)).Returns(_snapshotFormula);
            A.CallTo(() => _explicitFormulaMapper.MapToModel(_snapshotFormula)).Returns(_newFormula);
            A.CallTo(() => _moleculeListMapper.MapToSnapshot(_amountObserver.MoleculeList)).Returns(_moleculeListSnapshot);
            A.CallTo(() => _moleculeListMapper.MapToSnapshot(_containerObserver.MoleculeList)).Returns(_moleculeListSnapshot);
            A.CallTo(() => _moleculeListMapper.MapToModel(_moleculeListSnapshot)).Returns(_newMoleculeList);

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);
            A.CallTo(() => _objectBaseFactory.Create <AmountObserverBuilder>()).Returns(new AmountObserverBuilder());
            A.CallTo(() => _objectBaseFactory.Create <ContainerObserverBuilder>()).Returns(new ContainerObserverBuilder());

            return(_completed);
        }
        protected override void Context()
        {
            base.Context();
            var container = new Container();

            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(_oldValue)
                         .WithId("Id")
                         .WithDimension(_dimension)
                         .WithName("P1");
            _parameter.BuildingBlockType = PKSimBuildingBlockType.Simulation;
            container.Add(_parameter);
            _parameter.DisplayUnit = _unit;
            sut = new SetParameterValueCommand(_parameter, _valueToSet);
        }
Exemplo n.º 12
0
 protected override void Context()
 {
     base.Context();
     _para1          = DomainHelperForSpecs.ConstantParameterWithValue(_value1).WithName(CoreConstants.Parameter.EHC_ENABLED).WithDimension(A.Fake <IDimension>());
     _para1.Editable = true;
     _para2          = DomainHelperForSpecs.ConstantParameterWithValue(_value2).WithName("para2").WithDimension(A.Fake <IDimension>());
     _para2.Editable = true;
     _para3          = DomainHelperForSpecs.ConstantParameterWithValue(_value3).WithName(CoreConstants.Parameter.PARTICLE_DISPERSE_SYSTEM).WithDimension(A.Fake <IDimension>());
     _para3.Editable = true;
     A.CallTo(_executionContext).WithReturnType <IPKSimBuildingBlock>().Returns(A.Fake <IPKSimBuildingBlock>());
     _parameterToScale.Add(_para1);
     _parameterToScale.Add(_para2);
     _parameterToScale.Add(_para3);
 }
Exemplo n.º 13
0
 protected override void Context()
 {
     base.Context();
     _para1          = DomainHelperForSpecs.ConstantParameterWithValue(_value1).WithName("para1").WithDimension(A.Fake <IDimension>());
     _para1.Editable = true;
     _para2          = DomainHelperForSpecs.ConstantParameterWithValue(_value2).WithName("para2").WithDimension(A.Fake <IDimension>());
     _para2.Editable = true;
     _para3          = DomainHelperForSpecs.ConstantParameterWithValue(_value3).WithName("para3").WithDimension(A.Fake <IDimension>());
     _para3.Editable = false;
     A.CallTo(() => _executionContext.BuildingBlockContaining(_para1)).Returns(A.Fake <IPKSimBuildingBlock>());
     A.CallTo(() => _executionContext.BuildingBlockContaining(_para2)).Returns(A.Fake <IPKSimBuildingBlock>());
     _parameterToScale.Add(_para1);
     _parameterToScale.Add(_para2);
     _parameterToScale.Add(_para3);
 }
 protected override void Context()
 {
     base.Context();
     _protein = A.Fake <IndividualProtein>();
     _protein.QueryConfiguration = "toto";
     _exp1     = new MoleculeExpressionContainer().WithName("exp1");
     _exp2     = new MoleculeExpressionContainer().WithName("exp2");
     _expInfo1 = A.Fake <ExpressionContainerInfo>();
     _expInfo2 = A.Fake <ExpressionContainerInfo>();
     A.CallTo(() => _protein.AllExpressionsContainers()).Returns(new[] { _exp1, _exp2 });
     _proteinContent = 10;
     A.CallTo(() => _protein.ReferenceConcentration).Returns(DomainHelperForSpecs.ConstantParameterWithValue(_proteinContent));
     A.CallTo(() => _expressionContainerMapper.MapFrom(_exp1)).Returns(_expInfo1);
     A.CallTo(() => _expressionContainerMapper.MapFrom(_exp2)).Returns(_expInfo2);
 }
Exemplo n.º 15
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_advancedParameter);

            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(5);
            _mappedAdvancedParameter = new AdvancedParameter {
                DistributedParameter = DomainHelperForSpecs.NormalDistributedParameter()
            };
            _pathCache = new PathCacheForSpecs <IParameter> {
                { _advancedParameter.ParameterPath, _parameter }
            };
            A.CallTo(() => _advancedParameterFactory.Create(_parameter, DistributionTypes.ById(_snapshot.DistributionType))).Returns(_mappedAdvancedParameter);
        }
Exemplo n.º 16
0
 protected override void Context()
 {
     base.Context();
     _para1          = DomainHelperForSpecs.ConstantParameterWithValue(_value1).WithName(Constants.Parameters.EHC_ENABLED);
     _para1.Editable = true;
     _para2          = DomainHelperForSpecs.ConstantParameterWithValue(_value2).WithName("para2");
     _para2.Editable = true;
     _para3          = DomainHelperForSpecs.ConstantParameterWithValue(_value3).WithName(Constants.Parameters.PARTICLE_DISPERSE_SYSTEM);
     _para3.Editable = true;
     _parameterToScale.Add(_para1);
     _parameterToScale.Add(_para2);
     _parameterToScale.Add(_para3);
     _setCommand = A.Fake <IPKSimCommand>();
     A.CallTo(() => _parameterTask.SetParameterValue(_para2, _value2 * _factor, true)).Returns(_setCommand);
 }
        protected override void Context()
        {
            base.Context();

            _ddiRatioSimulation = new IndividualSimulation();
            //Simulate calculated results by setting the DataRepository
            _ddiRatioSimulation.DataRepository = _simulation.DataRepository;

            _pkAnalysis = new PKAnalysis();
            _pkAnalysis.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(Constants.PKParameters.C_max));
            _pkAnalysis.Add(DomainHelperForSpecs.ConstantParameterWithValue(2).WithName(Constants.PKParameters.AUC_inf));

            A.CallTo(() => _globalPKAnalysisRunner.RunForDDIRatio(_simulation)).Returns(_ddiRatioSimulation);
            A.CallTo(() => _pkAnalysisTask.CalculateFor(_ddiRatioSimulation, _peripheralVenousBloodPlasma)).Returns(new IndividualPKAnalysis(_peripheralVenousBloodPlasma, _pkAnalysis));
        }
Exemplo n.º 18
0
        protected override void Context()
        {
            base.Context();
            _parameter = A.Fake <IParameter>().WithName(Constants.Parameters.MOL_WEIGHT);
            A.CallTo(() => _buildingBockRetriever.BuildingBlockContaining(_parameter)).Returns(null);

            _observedData = DomainHelperForSpecs.ObservedData();
            _observedData.ExtendedProperties.Add(new ExtendedProperty <string> {
                Name = Constants.ObservedData.MOLECULE, Value = "C"
            });
            _observedData.AllButBaseGrid().Each(c => c.DataInfo.MolWeight = 100);


            _observedDataList.AddRange(new[] { _observedData });
        }
Exemplo n.º 19
0
        protected override Task Context()
        {
            _parameterMapper         = A.Fake <ParameterMapper>();
            _expressionProfileMapper = A.Fake <ExpressionProfileMapper>();
            _dimensionRepository     = A.Fake <IDimensionRepository>();
            _individualFactory       = A.Fake <IIndividualFactory>();
            _originDataMapper        = A.Fake <OriginDataMapper>();
            _moleculeExpressionTask  = A.Fake <IMoleculeExpressionTask <ModelIndividual> >();

            sut = new IndividualMapper(_parameterMapper, _expressionProfileMapper, _originDataMapper, _individualFactory, _moleculeExpressionTask);

            _individual             = DomainHelperForSpecs.CreateIndividual();
            _individual.Name        = "Ind";
            _individual.Description = "Model Description";
            var kidney = _individual.EntityAt <IContainer>(Constants.ORGANISM, CoreConstants.Organ.KIDNEY);

            _parameterLiver        = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.LIVER, "PLiver");
            _parameterKidney       = _individual.EntityAt <IParameter>(Constants.ORGANISM, CoreConstants.Organ.KIDNEY, "PKidney");
            _parameterKidneyRelExp = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.REL_EXP);
            _parameterKidneyRelExp.DefaultValue = 10;
            kidney.Add(_parameterKidneyRelExp);

            _parameterLiver.ValueDiffersFromDefault().ShouldBeFalse();
            _parameterKidney.ValueDiffersFromDefault().ShouldBeFalse();

            _parameterKidney.Value = 40;
            _parameterKidney.ValueDiffersFromDefault().ShouldBeTrue();
            _parameterKidneyRelExp.Value = 50;
            _parameterKidneyRelExp.ValueDiffersFromDefault().ShouldBeTrue();

            _expressionProfile1 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(moleculeName: "Enz");
            _expressionProfile2 = DomainHelperForSpecs.CreateExpressionProfile <IndividualTransporter>(moleculeName: "Trans");
            _individual.AddExpressionProfile(_expressionProfile1);
            _individual.AddExpressionProfile(_expressionProfile2);


            _originDataSnapshot = new OriginData();
            A.CallTo(() => _originDataMapper.MapToSnapshot(_individual.OriginData)).Returns(_originDataSnapshot);

            _localizedParameterKidney = new LocalizedParameter {
                Path = "Organism|Kidney|PKidney"
            };
            A.CallTo(() => _parameterMapper.LocalizedParametersFrom(A <IEnumerable <IParameter> > ._))
            .Invokes(x => _mappedParameters = x.GetArgument <IEnumerable <IParameter> >(0).ToList())
            .Returns(new[] { _localizedParameterKidney });

            return(_completed);
        }
Exemplo n.º 20
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_individualSimulation, _project);

            var individualSimulation = new IndividualSimulation
            {
                Properties         = _simulationProperties,
                SimulationSettings = _settings,
                Model = _model
            };

            individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual)
            {
                Name          = _individual.Name,
                BuildingBlock = _individual
            });

            _modelProperties = new ModelProperties();
            A.CallTo(() => _modelPropertiesTask.DefaultFor(_individual.OriginData, _snapshot.Model)).Returns(_modelProperties);
            A.CallTo(() => _simulationFactory.CreateFrom(_individual, A <IReadOnlyList <Compound> > ._, _modelProperties, null)).Returns(individualSimulation);

            _outputSelection = new OSPSuite.Core.Domain.OutputSelections();
            _outputSelection.AddOutput(new QuantitySelection("PATH", QuantityType.BaseGrid));
            A.CallTo(() => _outputSelectionMapper.MapToModel(_snapshot.OutputSelections, individualSimulation)).Returns(_outputSelection);

            _solver = new SolverSettings();
            A.CallTo(() => _solverSettingsMapper.MapToModel(_snapshot.Solver)).Returns(_solver);

            _outputSchema = new OutputSchema();
            A.CallTo(() => _outputSchemaMapper.MapToModel(_snapshot.OutputSchema)).Returns(_outputSchema);

            A.CallTo(() => _curveChartMapper.MapToModel(_snapshotSimulationTimeProfile, A <SimulationAnalysisContext> ._))
            .Invokes(x => _context = x.GetArgument <SimulationAnalysisContext>(1))
            .Returns(_simulationTimeProfile);


            //ensure that run will be performed
            _snapshot.HasResults      = true;
            _calculatedDataRepository = DomainHelperForSpecs.ObservedData("Calculated");

            A.CallTo(() => _simulationRunner.RunSimulation(individualSimulation, A <SimulationRunOptions> ._))
            .Invokes(x => { individualSimulation.DataRepository = _calculatedDataRepository; });

            A.CallTo(() => _eventMappingMapper.MapToModel(_eventSelection, _project)).Returns(_eventMapping);
            A.CallTo(() => _observerSetMappingMapper.MapToModel(_observerSetSelection, _project)).Returns(_observerSetMapping);
        }
Exemplo n.º 21
0
        protected override void Context()
        {
            _executionContext = A.Fake <IExecutionContext>();
            _favoriteTask     = A.Fake <IFavoriteTask>();
            _project          = A.Fake <IProject>();
            sut = new ParameterTask(new EntityPathResolver(new ObjectPathFactoryForSpecs()), _executionContext, _favoriteTask);
            var dimensionFactory = new DimensionFactory();

            _volumeDimension = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 3
            }, "Volume", "L");
            _volumeDimension.AddUnit("mL", 1e-3, 0);
            _parameter           = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _parameter.Dimension = _volumeDimension;
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
        }
Exemplo n.º 22
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_alternativeWithSpecies);

            var newAlternativeWithSpecies = new ParameterAlternativeWithSpecies();

            A.CallTo(() => _parameterAlternativeFactory.CreateAlternativeFor(_parameterGroup)).Returns(newAlternativeWithSpecies);
            _snapshotParameter = new Parameter {
                Name = "P1"
            };
            _alternativeParameter = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(_snapshotParameter.Name);
            newAlternativeWithSpecies.Add(_alternativeParameter);
            _snapshot.Parameters = new[] { _snapshotParameter };
        }
Exemplo n.º 23
0
 protected override void Context()
 {
     _simulation1   = A.Fake <Simulation>();
     _lazyLoadTask  = A.Fake <ILazyLoadTask>();
     _rootContainer = new Container();
     _applications  = new EventGroup {
         Name = Constants.APPLICATIONS, ContainerType = ContainerType.EventGroup
     };
     _applications2 = new EventGroup {
         Name = "APPLICATIONS_2", ContainerType = ContainerType.EventGroup
     };
     _simulation1.Model.Root = _rootContainer;
     _rootContainer.Add(_applications);
     A.CallTo(() => _simulation1.BodyWeight).Returns(DomainHelperForSpecs.ConstantParameterWithValue(50));
     sut = new PKCalculationOptionsFactory(_lazyLoadTask);
 }
 protected override void Context()
 {
    base.Context();
    _individual = A.Fake<Individual>();
    var originData = new OriginData();
    originData.Population = new SpeciesPopulation();
    A.CallTo(() => _individual.OriginData).Returns(originData);
    var organism = new Organism();
    var ga = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.GESTATIONAL_AGE);
    ga.Info.MinValue = 24;
    ga.Info.MaxValue = 25;
    organism.Add(ga);
    organism.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.MEAN_WEIGHT));
    A.CallTo(() => _individual.IsPreterm).Returns(true);
    A.CallTo(() => _individual.Organism).Returns(organism);
 }
Exemplo n.º 25
0
        protected override void Context()
        {
            base.Context();
            _originalSimulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };
            _clonedSimulation = A.Fake <IndividualSimulation>();
            A.CallTo(() => _cloner.Clone(_originalSimulation)).Returns(_clonedSimulation);
            _pkSimulation = A.Fake <IndividualSimulation>().WithId("Clone");
            var interactionContainer = new Container();

            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(CoreConstants.Parameters.KI);
            interactionContainer.Add(_parameter);
            A.CallTo(() => _interactionTask.AllInteractionContainers(_pkSimulation)).Returns(new[] { interactionContainer });
            A.CallTo(() => _objectBaseFactory.Create <IndividualSimulation>()).Returns(_pkSimulation);
        }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(_xAxis, null, null, null);
            var pane1 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Liver"
            };

            curve1.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve1.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                LowerValue = 20, UpperValue = 30
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new TimeProfileXValue(3), new TimeProfileYValue {
                Y = 40
            });
            pane2.AddCurve(curve2);
        }
Exemplo n.º 27
0
            public T Clone <T>(T objectToClone) where T : class, IUpdatable
            {
                var schemaItem = objectToClone as ISchemaItem;

                if (schemaItem == null)
                {
                    return(default(T));
                }

                var cloneSchemaItem = new SchemaItem().WithName(Guid.NewGuid().ToString());

                cloneSchemaItem.FormulationKey  = schemaItem.FormulationKey;
                cloneSchemaItem.ApplicationType = schemaItem.ApplicationType;
                cloneSchemaItem.Add(DomainHelperForSpecs.ConstantParameterWithValue(schemaItem.Dose.Value).WithName(CoreConstants.Parameter.INPUT_DOSE));
                cloneSchemaItem.Add(DomainHelperForSpecs.ConstantParameterWithValue(schemaItem.StartTime.Value).WithName(Constants.Parameters.START_TIME));
                return(cloneSchemaItem.DowncastTo <T>());
            }
Exemplo n.º 28
0
        protected override void Context()
        {
            _createIndvidualAlgorithm           = A.Fake <ICreateIndividualAlgorithm>();
            _entityBaseFactory                  = A.Fake <IObjectBaseFactory>();
            _individualModelTask                = A.Fake <IIndividualModelTask>();
            _speciesRepository                  = A.Fake <ISpeciesRepository>();
            _entityValidator                    = A.Fake <IEntityValidator>();
            _reportGenerator                    = A.Fake <IReportGenerator>();
            _moleculeOntogenyVariabilityUpdater = A.Fake <IMoleculeOntogenyVariabilityUpdater>();
            sut = new IndividualFactory(_individualModelTask, _entityBaseFactory, _createIndvidualAlgorithm, _speciesRepository, _entityValidator, _reportGenerator, _moleculeOntogenyVariabilityUpdater);

            _age            = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.AGE);
            _gestationalAge = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.GESTATIONAL_AGE);
            _height         = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.HEIGHT);
            _weight         = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.WEIGHT);
            _bmi            = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.BMI);
        }
Exemplo n.º 29
0
        protected override void Context()
        {
            base.Context();
            _parameter1     = DomainHelperForSpecs.ConstantParameterWithValue(1);
            _parameter2     = DomainHelperForSpecs.ConstantParameterWithValue(2);
            _parameter3     = DomainHelperForSpecs.ConstantParameterWithValue(3);
            _parameterCache = A.Fake <PathCache <IParameter> >();
            A.CallTo(() => _parameterCache["PATH1"]).Returns(_parameter1);
            A.CallTo(() => _parameterCache["PATH2"]).Returns(_parameter2);
            A.CallTo(() => _parameterCache["PATH3"]).Returns(_parameter3);
            sut.SetValues("PATH1", new double[] { 1, 2, 3 });
            sut.SetValues("PATH2", new double[] { 4, 5, 6 });

            _cacheToMerge = new ParameterValuesCache();
            _cacheToMerge.SetValues("PATH1", new double[] { 7, 8 });
            _cacheToMerge.SetValues("PATH3", new double[] { 9, 10 });
        }
Exemplo n.º 30
0
        protected override void Context()
        {
            _parameters = new List <IParameter>();
            _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(10);

            _valueOrigin = new ValueOrigin
            {
                Method      = ValueOriginDeterminationMethods.Assumption,
                Source      = ValueOriginSources.Other,
                Description = "Hello"
            };

            _context = A.Fake <IExecutionContext>();

            sut = new UpdateParametersValueOriginCommand(_parameters, _valueOrigin);
        }