protected override void Context()
        {
            _cloneManager = A.Fake <ICloner>();
            _individualToPopulationSettingsMapper = A.Fake <IIndividualToPopulationSettingsMapper>();

            sut = new PopulationSettingsDTOMapper(_individualToPopulationSettingsMapper, _cloneManager);
        }
 public PopulationSettingsMapper(IOriginDataMapper originDataMapper, IIndividualFactory individualFactory,
                                 IIndividualToPopulationSettingsMapper individualToPopulationSettingsMapper, IGenderRepository genderRepository)
 {
     _originDataMapper  = originDataMapper;
     _individualFactory = individualFactory;
     _individualToPopulationSettingsMapper = individualToPopulationSettingsMapper;
     _genderRepository = genderRepository;
 }
Example #3
0
 public RandomPopulationSettingsMapper(
     ParameterRangeMapper parameterRangeMapper,
     IndividualMapper individualMapper,
     IIndividualToPopulationSettingsMapper populationSettingsMapper,
     IGenderRepository genderRepository)
 {
     _parameterRangeMapper     = parameterRangeMapper;
     _populationSettingsMapper = populationSettingsMapper;
     _genderRepository         = genderRepository;
     _individualMapper         = individualMapper;
 }
 protected override void Context()
 {
     _orginDataMapper   = A.Fake <IOriginDataMapper>();
     _individualFactory = A.Fake <IIndividualFactory>();
     _popSettingsMapper = A.Fake <IIndividualToPopulationSettingsMapper>();
     _genderRepository  = A.Fake <IGenderRepository>();
     _female            = new Gender();
     _male = new Gender();
     A.CallTo(() => _genderRepository.Female).Returns(_female);
     A.CallTo(() => _genderRepository.Male).Returns(_male);
     sut = new PopulationSettingsMapper(_orginDataMapper, _individualFactory, _popSettingsMapper, _genderRepository);
 }
        protected override Task Context()
        {
            _individualMapper         = A.Fake <IndividualMapper>();
            _parameterRangeMapper     = A.Fake <ParameterRangeMapper>();
            _genderRepository         = A.Fake <IGenderRepository>();
            _populationSettingsMapper = A.Fake <IIndividualToPopulationSettingsMapper>();
            sut = new RandomPopulationSettingsMapper(_parameterRangeMapper, _individualMapper, _populationSettingsMapper, _genderRepository);

            _ageParameterRange = new ConstrainedParameterRange {
                ParameterName = CoreConstants.Parameters.AGE
            };
            _weightParameterRange = new ParameterRange {
                ParameterName = CoreConstants.Parameters.MEAN_WEIGHT
            };

            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(null)).Returns((Snapshots.ParameterRange)null);
            _ageRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_ageParameterRange)).Returns(_ageRangeSnapshot);

            _weightRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_weightParameterRange)).Returns(_weightRangeSnapshot);


            _baseIndividual     = new Individual();
            _snapshotIndividual = new Snapshots.Individual();
            A.CallTo(() => _individualMapper.MapToSnapshot(_baseIndividual)).Returns(_snapshotIndividual);

            _randomPopulationSettings = new RandomPopulationSettings
            {
                NumberOfIndividuals = 10,
                BaseIndividual      = _baseIndividual
            };

            _randomPopulationSettings.AddParameterRange(_weightParameterRange);
            _randomPopulationSettings.AddParameterRange(_ageParameterRange);

            A.CallTo(() => _genderRepository.Female).Returns(new Gender {
                Id = "Female", Name = "Female"
            });
            A.CallTo(() => _genderRepository.Male).Returns(new Gender {
                Id = "Male", Name = "Male"
            });
            return(Task.FromResult(true));
        }
Example #6
0
        protected override Task Context()
        {
            _individualMapper         = A.Fake <IndividualMapper>();
            _parameterRangeMapper     = A.Fake <ParameterRangeMapper>();
            _genderRepository         = A.Fake <IGenderRepository>();
            _populationSettingsMapper = A.Fake <IIndividualToPopulationSettingsMapper>();
            _logger = A.Fake <IOSPSuiteLogger>();
            sut     = new RandomPopulationSettingsMapper(_parameterRangeMapper, _individualMapper, _populationSettingsMapper, _genderRepository, _logger);

            _ageParameterRange = new ConstrainedParameterRange {
                ParameterName = CoreConstants.Parameters.AGE
            };
            _weightParameterRange = new ParameterRange {
                ParameterName = CoreConstants.Parameters.MEAN_WEIGHT
            };

            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(null)).Returns((Snapshots.ParameterRange)null);
            _ageRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_ageParameterRange)).Returns(_ageRangeSnapshot);

            _weightRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_weightParameterRange)).Returns(_weightRangeSnapshot);


            _baseIndividual = new Individual
            {
                OriginData = new OriginData()
            };
            _diseaseStateParameter = new OriginDataParameter(10, "mg/kg", "DIS_STATE_PARAM");
            _baseIndividual.OriginData.AddDiseaseStateParameter(_diseaseStateParameter);

            _diseaseStateParameterRangeSnapshot = new Snapshots.ParameterRange();
            _diseaseStateParameterRange         = new ConstrainedParameterRange {
                ParameterName = _diseaseStateParameter.Name
            };
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_diseaseStateParameterRange)).Returns(_diseaseStateParameterRangeSnapshot);


            _snapshotIndividual = new Snapshots.Individual();
            A.CallTo(() => _individualMapper.MapToSnapshot(_baseIndividual)).Returns(_snapshotIndividual);

            _randomPopulationSettings = new RandomPopulationSettings
            {
                NumberOfIndividuals = 10,
                BaseIndividual      = _baseIndividual
            };

            _randomPopulationSettings.AddParameterRange(_weightParameterRange);
            _randomPopulationSettings.AddParameterRange(_ageParameterRange);
            _randomPopulationSettings.AddParameterRange(_diseaseStateParameterRange);

            A.CallTo(() => _genderRepository.Female).Returns(new Gender {
                Id = "Female", Name = "Female"
            });
            A.CallTo(() => _genderRepository.Male).Returns(new Gender {
                Id = "Male", Name = "Male"
            });

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            return(Task.FromResult(true));
        }
Example #7
0
 public PopulationSettingsDTOMapper(IIndividualToPopulationSettingsMapper individualToPopulationSettingsMapper, ICloner cloner)
 {
     _individualToPopulationSettingsMapper = individualToPopulationSettingsMapper;
     _cloner = cloner;
 }