public CompoundProperties MapFrom(Compound compound) { var compoundProperties = new CompoundProperties { Compound = compound }; foreach (var category in _categoryRepository.All()) { var compoundCalculationMethod = compound.CalculationMethodFor(category) ?? category.DefaultItem; compoundProperties.AddCalculationMethod(compoundCalculationMethod); } //update default mapping for alternatives in compound foreach (var alternativeGroup in compound.AllParameterAlternativeGroups()) { var compoundGroupSelection = new CompoundGroupSelection { AlternativeName = alternativeGroup.DefaultAlternative.Name, GroupName = alternativeGroup.Name }; compoundProperties.AddCompoundGroupSelection(compoundGroupSelection); } return(compoundProperties); }
public void compound_must_have_new_calculation_method_set_for_category() { _compound.CalculationMethodFor(_cateogry).ShouldBeEqualTo(_newCalculationMethod); }