private void replaceCalculationMethodsWithNewCalculationMethods(IEnumerable <CalculationMethodWithCompoundName> combination, IWithCalculationMethods compoundProperties) { if (compoundProperties == null) { return; } combination.Each(method => { compoundProperties.RemoveCalculationMethodFor(method.CalculationMethod.Category); compoundProperties.AddCalculationMethod(method.CalculationMethod); }); }
protected override void Context() { base.Context(); _category = new CalculationMethodCategory { Name = "Compound" }; var cm1 = new CalculationMethod { Name = "tralala", Category = _category.Name }; _cm2 = new CalculationMethod { Name = "tutu", Category = _category.Name }; _category.Add(cm1); _category.Add(_cm2); _withCalculationMethods = new CompoundProperties(); _withCalculationMethods.AddCalculationMethod((cm1)); _allCalculationMethodCategories.Add(_category); sut.Edit(_withCalculationMethods); _allDTOs[0].CalculationMethod = _cm2; }