private IMoBiCommand withUpdatedDefaultStateAndValueOrigin(IMoBiCommand executedCommand, IFormula formula, IBuildingBlock buildingBlock) { if (executedCommand.IsEmpty()) { return(executedCommand); } var parametersUsingFormula = _parameterInBuildingBlockRetriever.AllFrom(buildingBlock, p => Equals(p.Formula, formula)); if (!parametersUsingFormula.Any()) { return(executedCommand); } var updateValueOriginCommand = new MoBiMacroCommand(); parametersUsingFormula.Each(p => updateValueOriginCommand.Add(_quantityTask.UpdateDefaultStateAndValueOriginFor(p, buildingBlock))); //we have depending parameters but they all have default state and value origin set; if (updateValueOriginCommand.IsEmtpy) { return(executedCommand); } var macroCommand = new MoBiMacroCommand().WithHistoryEntriesFrom(executedCommand); macroCommand.Add(executedCommand); macroCommand.AddRange(updateValueOriginCommand.All()); return(macroCommand); }
private IOSPSuiteCommand withUpdatedDefaultStateAndValueOrigin <T>( IOSPSuiteCommand executedCommand, IQuantity quantity, T buildingBlockOrSimulation, Func <IParameter, bool, T, ICommand> setParameterDefaultStateFunc, Func <IParameter, ValueOrigin, T, ICommand> setParameterValueOriginFunc ) { if (executedCommand.IsEmpty() || executedCommand.IsEmptyMacro()) { return(executedCommand); } var updateCommand = new MoBiMacroCommand(); addUpdateDefaultStateAndValueOriginCommand(updateCommand, quantity, buildingBlockOrSimulation, setParameterDefaultStateFunc, setParameterValueOriginFunc); if (updateCommand.IsEmtpy) { return(executedCommand); } var macroCommand = new MoBiMacroCommand().WithHistoryEntriesFrom(executedCommand); macroCommand.Add(executedCommand); macroCommand.AddRange(updateCommand.All()); return(macroCommand); }
public void should_update_the_default_state_and_value_origin_of_parameters_using_the_formula_by_leverage_the_quantity_task_command() { _command.IsEmtpy.ShouldBeFalse(); _command.All().ShouldContain(_updateCommand1); }
public void the_commands_should_be_remove_simulation_type() { _result.All().Each(command => command.ShouldBeAnInstanceOf <RemoveSimulationCommand>()); }