public void should_remove_units_when_path_is_not_found()
 {
     _results.AllParameterPaths().Contains("Organism|VenousBlood|Volume").ShouldBeTrue();
     _results.AllParameterPaths().Contains("Organism|VenousBlood|Volume [l]").ShouldBeFalse();
     _results.ParameterValuesCache.Has("Organism|VenousBlood|Volume [l]").ShouldBeTrue();
     _results.ParameterValuesCache.Has("Organism|VenousBlood|Volume").ShouldBeTrue();
 }
        protected override void Context()
        {
            base.Context();
            _individualPropertiesCache = A.Fake <IndividualValuesCache>();
            _patchCache = new PathCacheForSpecs <IParameter>();
            var individualParameter = A.Fake <IParameter>();

            A.CallTo(() => individualParameter.IsChangedByCreateIndividual).Returns(true);
            _patchCache.Add("Path1", individualParameter);

            var advancedParameter = A.Fake <IParameter>();

            A.CallTo(() => advancedParameter.IsChangedByCreateIndividual).Returns(false);
            advancedParameter.CanBeVariedInPopulation = true;
            _patchCache.Add("PathAdvanced", advancedParameter);

            A.CallTo(() => _individualPropertiesCache.AllParameterPaths()).Returns(new[] { "Path1", "Path2", "PathAdvanced" });
            A.CallTo(() => _individualPropertiesCache.ParameterValuesFor("Path1")).Returns(_value1);
            A.CallTo(() => _individualPropertiesCache.ParameterValuesFor("Path2")).Returns(_value2);
            A.CallTo(() => _individualPropertiesCache.ParameterValuesFor("PathAdvanced")).Returns(_value3);
            _populationSimulation = A.Fake <PopulationSimulation>();
            _parameterValueCache  = A.Fake <ParameterValuesCache>();
            A.CallTo(() => _populationSimulation.ParameterValuesCache).Returns(_parameterValueCache);
            _mobiPopulation = A.Fake <MoBiPopulation>();
            A.CallTo(_simulationFactory).WithReturnType <PopulationSimulation>().Returns(_populationSimulation);
            A.CallTo(() => _objectBaseFactory.Create <MoBiPopulation>()).Returns(_mobiPopulation);
            A.CallTo(() => _parameterRetriever.ParametersFrom(_populationSimulation)).Returns(_patchCache);
            A.CallTo(() => _individualPropertiesCacheImporter.ImportFrom(_populationFile, _patchCache, A <IImportLogger> ._)).Returns(_individualPropertiesCache);

            _advancedParameterContainer = new AdvancedParameter();
            A.CallTo(() => _advancedParameterFactory.Create(advancedParameter, DistributionTypes.Unknown)).Returns(_advancedParameterContainer);
        }
Example #3
0
        public void should_return_enzyme_ontogenies()
        {
            var parameterPaths = _result.AllParameterPaths().ToArray();

            foreach (var moleculeOntogeny in _populationCharacteristics.MoleculeOntogenies)
            {
                parameterPaths.ShouldContain($"{moleculeOntogeny.Molecule}|{CoreConstants.Parameters.ONTOGENY_FACTOR}");
                parameterPaths.ShouldContain($"{moleculeOntogeny.Molecule}|{CoreConstants.Parameters.ONTOGENY_FACTOR_GI}");
            }
        }
        private void validate(IndividualValuesCache individualValues, IImportLogger logger)
        {
            foreach (var parameterPath in individualValues.AllParameterPaths().ToList())
            {
                if (allParametersContains(parameterPath))
                {
                    continue;
                }

                logger.AddWarning(PKSimConstants.Warning.ParameterWithPathNotFoundInBaseIndividual(parameterPath));
                individualValues.Remove(parameterPath);
            }
        }