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)); }
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)); }