/// <summary> /// Setup that include test data /// </summary> public virtual void Setup() { this.session = new Mock <ISession>(); this.uri = new Uri("http://www.rheagroup.com"); this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.InitializeRefData(); this.domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri) { ShortName = "SYS", Name = "System" }; this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri); this.option_A = new Option(Guid.NewGuid(), this.cache, this.uri) { ShortName = "OPT_A", Name = "Option A" }; this.option_B = new Option(Guid.NewGuid(), this.cache, this.uri) { ShortName = "OPT_B", Name = "Option B" }; this.InitializeElementDef(); this.iteration.Option.Add(this.option_A); this.iteration.Option.Add(this.option_B); this.iteration.DefaultOption = this.option_A; this.iteration.Element.Add(this.rootEd); this.iteration.Element.Add(this.ssEd); this.iteration.TopElement = this.rootEd; var subSysdef = new SubSystemDefinition(new List <Category> { this.ssCat }, new List <Category> { this.eqtCat }); var extraConfig = new ExtraMassContributionConfiguration(new List <Category> { this.consCat }, this.mass, this.massMargin); var paramConfig = new MassBudgetParameterConfig(new BudgetParameterMarginPair(this.mass, this.massMargin), new List <ExtraMassContributionConfiguration> { extraConfig }); this.MassBudgetConfig = new BudgetConfig(new List <ElementDefinition> { this.rootEd }, new List <SubSystemDefinition> { subSysdef }, paramConfig, this.number, null, null, null); }
/// <summary> /// Executes the <see cref="OkCommand"/> /// </summary> private void ExecuteOkCommand() { var subSysDefinitions = new List <SubSystemDefinition>(); foreach (var ssDef in this.SubSystemDefinitions) { var subSysCat = new SubSystemDefinition(ssDef.SubSystemDefinitions.SelectedCategories, ssDef.SubSystemElementDefinition.SelectedCategories); if (subSysDefinitions.Contains(subSysCat)) { continue; } subSysDefinitions.Add(subSysCat); } BudgetParameterConfigBase parameterConfig; switch (this.SelectedBudgetKind) { case BudgetKind.Mass: var massBudgetVm = (MassBudgetParameterConfigViewModel)this.BudgetParameterConfig; var drymassConfig = new BudgetParameterMarginPair(massBudgetVm.DryMassConfig.SelectedParameterType, massBudgetVm.DryMassConfig.SelectedMarginParameterType); var extraConf = new List <ExtraMassContributionConfiguration>(); foreach (var extraMassContributionConfigurationViewModel in massBudgetVm.ExtraMassContributions) { extraConf.Add(new ExtraMassContributionConfiguration(extraMassContributionConfigurationViewModel.SelectedCategories, extraMassContributionConfigurationViewModel.SelectedParameter, extraMassContributionConfigurationViewModel.SelectedMarginParameter)); } parameterConfig = new MassBudgetParameterConfig(drymassConfig, extraConf); break; case BudgetKind.Generic: var costBudgetVm = (GenericBudgetParameterConfigViewModel)this.BudgetParameterConfig; parameterConfig = new GenericBudgetParameterConfig(new BudgetParameterMarginPair(costBudgetVm.GenericConfig.SelectedParameterType, costBudgetVm.GenericConfig.SelectedMarginParameterType)); break; default: throw new NotImplementedException($"Case {this.SelectedBudgetKind} not implemented"); } var config = new BudgetConfig(this.SelectedElements, subSysDefinitions, parameterConfig, this.NumberOfElement, this.SystemLevel, this.SelectedSubSystemEnum, this.SelectedEquipmentEnum); this.DialogResult = new BudgetConfigDialogResult(true, config); }