private void checkPopulationAgeSettings(string populationName, string genderName) { //get age settings for the given population (currently gender-independent, might change in the future) var populationAgeSettings = _populationAgeRepository.PopulationAgeSettingsFrom(populationName); (var minAge, var maxAge) = getAgeBoundsFor(populationName, genderName); //---- min/max of the age should be set to min/max age available for this population populationAgeSettings.MinAge.ShouldBeEqualTo(minAge, $"Min age for {populationName}|{genderName}"); populationAgeSettings.MaxAge.ShouldBeEqualTo(maxAge, $"Max age for {populationName}|{genderName}"); //default age of the population should be between min and max age populationAgeSettings.DefaultAge.ShouldBeGreaterThanOrEqualTo(minAge); populationAgeSettings.DefaultAge.ShouldBeSmallerThanOrEqualTo(maxAge); }
private void setAgeSettings(IParameter ageParameter, string population, bool setValueAndDisplayUnit) { if (ageParameter == null) { return; } var populationAgeSettings = _populationAgeRepository.PopulationAgeSettingsFrom(population); ageParameter.MinValue = populationAgeSettings.MinAge; ageParameter.MaxValue = populationAgeSettings.MaxAge; if (!setValueAndDisplayUnit) { return; } ageParameter.Value = populationAgeSettings.DefaultAge; ageParameter.DisplayUnit = ageParameter.Dimension.UnitOrDefault(populationAgeSettings.DefaultAgeUnit); }