protected override void ClearReferences()
 {
     _simulation  = null;
     _formulaTask = null;
     _affectedBuildingBlockRetriever = null;
     _buildingBlockFromSimulation    = null;
 }
        protected override void Context()
        {
            _simulation                = new MoBiSimulation();
            _buildingBlock             = new MoleculeBuildingBlock();
            _formulaParameter          = new Parameter().WithFormula(new ExplicitFormula()).WithName("formula");
            _formulaParameter.Value    = 9;
            _constantParameter         = new Parameter().WithFormula(new ConstantFormula(1.0)).WithName("constant");
            _unaffectedParameter       = new Parameter().WithFormula(new ConstantFormula(1.0)).WithName("unaffected");
            _unaffectedParameter.Value = 5.0;
            _constantParameter.Value   = 9;
            _simulation.Model          = new Model {
                Root = new Container {
                    _formulaParameter, _constantParameter, _unaffectedParameter
                }
            };
            _context = A.Fake <IMoBiContext>();

            sut = new ResetFixedConstantParametersToDefaultInSimulationCommand <MoleculeBuildingBlock>(_simulation, _buildingBlock);

            _affectedBuildingBlockRetriever = A.Fake <IAffectedBuildingBlockRetriever>();
            _formulaTask = A.Fake <IMoBiFormulaTask>();

            A.CallTo(() => _formulaTask.CreateNewFormula <ConstantFormula>(A <IDimension> ._)).Returns(new ConstantFormula());

            A.CallTo(() => _context.Resolve <IAffectedBuildingBlockRetriever>()).Returns(_affectedBuildingBlockRetriever);
            A.CallTo(() => _context.Resolve <IMoBiFormulaTask>()).Returns(_formulaTask);
            var buildingBlockInfo = new MoleculesInfo {
                BuildingBlock = _buildingBlock
            };

            A.CallTo(() => _affectedBuildingBlockRetriever.RetrieveFor(_constantParameter, _simulation)).Returns(buildingBlockInfo);
            A.CallTo(() => _affectedBuildingBlockRetriever.RetrieveFor(_formulaParameter, _simulation)).Returns(buildingBlockInfo);
        }
Esempio n. 3
0
 public SimulationUpdateTask(IModelConstructor modelConstructor, IBuildConfigurationFactory buildConfigurationFactory,
                             IMoBiContext context, IMoBiApplicationController applicationController, IDimensionValidator dimensionValidator, IEntityPathResolver entityPathResolver, IAffectedBuildingBlockRetriever affectedBuildingBlockRetriever)
 {
     _modelConstructor          = modelConstructor;
     _buildConfigurationFactory = buildConfigurationFactory;
     _context = context;
     _applicationController          = applicationController;
     _dimensionValidator             = dimensionValidator;
     _entityPathResolver             = entityPathResolver;
     _affectedBuildingBlockRetriever = affectedBuildingBlockRetriever;
 }
        protected override void ExecuteWith(IMoBiContext context)
        {
            _formulaTask = context.Resolve <IMoBiFormulaTask>();
            _affectedBuildingBlockRetriever = context.Resolve <IAffectedBuildingBlockRetriever>();

            var fixedParameters = fixedConstantParametersFromBuildingBlock();

            resetFixedParametersInSimulation(fixedParameters);

            context.PublishEvent(new ParameterChangedEvent(fixedParameters));
        }
Esempio n. 5
0
        protected override void Context()
        {
            _affectedBuildingBlockRetriever = A.Fake <IAffectedBuildingBlockRetriever>();
            _entityPathResolver             = A.Fake <IEntityPathResolver>();
            _context = A.Fake <IMoBiContext>();
            sut      = new QuantitySynchronizer(_affectedBuildingBlockRetriever, _entityPathResolver, _context);

            _simulation        = A.Fake <IMoBiSimulation>();
            _buildingBlockInfo = A.Fake <IBuildingBlockInfo>();
            _objectPath        = new ObjectPath("P");
            A.CallTo(() => _entityPathResolver.ObjectPathFor(_parameter, false)).Returns(_objectPath);
            A.CallTo(() => _entityPathResolver.PathFor(_parameter)).Returns("P");
            A.CallTo(() => _affectedBuildingBlockRetriever.RetrieveFor(_quantity, _simulation)).Returns(_buildingBlockInfo);
        }
Esempio n. 6
0
        protected override void Context()
        {
            _modelConstructor          = A.Fake <IModelConstructor>();
            _buildConfigurationFactory = A.Fake <IBuildConfigurationFactory>();
            _objectPathFactory         = A.Fake <IObjectPathFactory>();
            _context = A.Fake <IMoBiContext>();
            _applicationController          = A.Fake <IMoBiApplicationController>();
            _configurePresenter             = A.Fake <IConfigureSimulationPresenter>();
            _validationVisitor              = A.Fake <IDimensionValidator>();
            _affectedBuildingBlockRetriever = A.Fake <IAffectedBuildingBlockRetriever>();
            _entityPathResolver             = new EntityPathResolverForSpecs();
            A.CallTo(() => _applicationController.Start <IConfigureSimulationPresenter>()).Returns(_configurePresenter);

            sut = new SimulationUpdateTask(_modelConstructor, _buildConfigurationFactory, _context, _applicationController, _validationVisitor, _entityPathResolver, _affectedBuildingBlockRetriever);
        }
Esempio n. 7
0
 public QuantitySynchronizer(IAffectedBuildingBlockRetriever affectedBuildingBlockRetriever, IEntityPathResolver entityPathResolver, IMoBiContext context)
 {
     _affectedBuildingBlockRetriever = affectedBuildingBlockRetriever;
     _entityPathResolver             = entityPathResolver;
     _context = context;
 }
 protected override void Context()
 {
     _affectedBuildingBlockRetriever = A.Fake <IAffectedBuildingBlockRetriever>();
     _eventPublisher = A.Fake <IEventPublisher>();
     sut             = new BuildConfigurationUpdater(_affectedBuildingBlockRetriever, _eventPublisher);
 }
Esempio n. 9
0
 public BuildConfigurationUpdater(IAffectedBuildingBlockRetriever affectedBuildingBlockRetriever, IEventPublisher eventPublisher)
 {
     _affectedBuildingBlockRetriever = affectedBuildingBlockRetriever;
     _eventPublisher = eventPublisher;
 }