Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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>());
 }