예제 #1
0
 protected override void Context()
 {
     base.Context();
     _value = 5;
     _parameterValueDefinition = new ParameterValueMetaData {
         DefaultValue = _value
     };
 }
        protected IParameter CreateMoleculeParameterIn(IContainer parameterContainer, string parameterName, double defaultValue)
        {
            var parameterRateMetaData = _parameterRateRepository.ParameterMetaDataFor(_containerPath, parameterName);
            var parameterValue        = new ParameterValueMetaData();

            parameterValue.UpdatePropertiesFrom(parameterRateMetaData);
            parameterValue.DefaultValue = defaultValue;
            return(CreateConstantParameterIn(parameterContainer, parameterValue));
        }
예제 #3
0
 protected override void Context()
 {
     base.Context();
     _parameterValueDefinition = new ParameterValueMetaData();
     _parameterValueDefinition.ParameterName = "tralal";
     _valueFormula = A.Fake <IFormula>();
     _parameter    = A.Fake <IParameter>();
     _displayUnit  = A.Fake <Unit>();
     A.CallTo(() => _formulaFactory.ValueFor(_parameterValueDefinition)).Returns(_valueFormula);
     A.CallTo(() => _objectBaseFactory.CreateParameter()).Returns(_parameter);
     A.CallTo(() => _dimensionRepository.DimensionByName(_parameterValueDefinition.Dimension)).Returns(_dimension);
     A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_parameter)).Returns(_displayUnit);
 }
        protected IParameter CreateConstantParameterIn(IContainer parameterContainer,
                                                       ParameterValueMetaData parameterValueDefinition,
                                                       string groupName = CoreConstants.Groups.RELATIVE_EXPRESSION)
        {
            var parameter = _parameterFactory.CreateFor(parameterValueDefinition);

            parameterContainer.Add(parameter);
            if (!string.IsNullOrEmpty(groupName))
            {
                parameter.GroupName = groupName;
            }

            //All constant parameters do not have default values
            parameter.DefaultValue = null;
            return(parameter);
        }
        protected override void Context()
        {
            _parameterQuery   = A.Fake <IParameterQuery>();
            _parameterFactory = A.Fake <IParameterFactory>();
            _originData       = new OriginData();
            _param1           = A.Fake <IParameter>();
            _param1.Name      = "param1";
            var paramDef1 = new ParameterValueMetaData
            {
                BuildingBlockType = PKSimBuildingBlockType.Individual
            };

            _param2      = A.Fake <IParameter>();
            _param2.Name = "param2";
            var paramDef2 = new ParameterValueMetaData
            {
                BuildingBlockType = PKSimBuildingBlockType.Individual
            };

            _param3      = A.Fake <IParameter>();
            _param3.Name = "param3";
            var paramDef3 = new ParameterValueMetaData
            {
                BuildingBlockType = PKSimBuildingBlockType.Compound
            };

            _valueDefinitions.Add(paramDef1);
            _valueDefinitions.Add(paramDef2);
            var paramRateDef1 = new ParameterRateMetaData();

            paramDef3.BuildingBlockType = PKSimBuildingBlockType.Individual;
            _rateDefinitions.Add(paramRateDef1);

            _paramRate1      = new PKSimParameter().WithFormula(new ExplicitFormula("a formula"));
            _paramRate1.Name = "RateParameter";
            A.CallTo(_parameterQuery).WithReturnType <IEnumerable <ParameterValueMetaData> >().Returns(_valueDefinitions);
            A.CallTo(_parameterQuery).WithReturnType <IEnumerable <ParameterDistributionMetaData> >().Returns(_distributionDefinitions);
            A.CallTo(_parameterQuery).WithReturnType <IEnumerable <ParameterRateMetaData> >().Returns(_rateDefinitions);
            A.CallTo(() => _parameterFactory.CreateFor(paramDef1)).Returns(_param1);
            A.CallTo(() => _parameterFactory.CreateFor(paramDef2)).Returns(_param2);
            A.CallTo(() => _parameterFactory.CreateFor(paramRateDef1, A <FormulaCache> ._)).Returns(_paramRate1);

            sut = new ParameterContainerTask(_parameterQuery, _parameterFactory);
        }
예제 #6
0
        protected override void Context()
        {
            _compartment = A.Fake <Compartment>();
            A.CallTo(() => _compartment.OrganName).Returns("MyParentOrgan");
            _compartment.Name = "MyComp";
            var containerPath = new ObjectPath(new[] { _compartment.OrganName, _compartment.Name }).ToString();

            _containerPathRetriever = A.Fake <IEntityPathResolver>();
            A.CallTo(() => _containerPathRetriever.PathFor(_compartment)).Returns(containerPath);
            _originData            = new OriginData();
            _originData.Population = new SpeciesPopulation();
            var distributionDefinition = new ParameterDistributionMetaData();
            var rateDefinition         = new ParameterRateMetaData();
            var valueDefinition        = new ParameterValueMetaData();

            distributionDefinition.ParameterName = "tutu";
            var distributionRepository = A.Fake <IParameterDistributionRepository>();

            A.CallTo(() => distributionRepository.AllFor(containerPath)).Returns(new List <ParameterDistributionMetaData> {
                distributionDefinition
            });

            var rateRepository = A.Fake <IParameterRateRepository>();

            A.CallTo(() => rateRepository.AllFor(containerPath)).Returns(new List <ParameterRateMetaData> {
                rateDefinition
            });

            var valueRepository = A.Fake <IParameterValueRepository>();

            A.CallTo(() => valueRepository.AllFor(containerPath)).Returns(new List <ParameterValueMetaData> {
                valueDefinition
            });

            sut = new ParameterQuery(distributionRepository, valueRepository, rateRepository, _containerPathRetriever);
        }