示例#1
0
        protected override void Context()
        {
            _msvCreator = A.Fake <IMoleculeStartValuesCreator>();

            A.CallTo(() => _msvCreator.CreateMoleculeStartValue(A <IObjectPath> .Ignored, A <string> .Ignored, A <IDimension> .Ignored, A <Unit> ._, A <ValueOrigin> ._))
            .ReturnsLazily((IObjectPath path, string moleculeName, IDimension dimension) => new MoleculeStartValue {
                ContainerPath = path, Name = moleculeName, Dimension = dimension
            });

            _concentrationDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.MOLAR_CONCENTRATION, "mol/l");

            _amountDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.AMOUNT, "mol");
            _amountDimension.AddUnit("mmol", 0.001, 0);

            _timeDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.TIME, "s");
            _timeDimension.Unit("s").Factor = 1.0 / 60;

            _dimensionFactory         = A.Fake <IMoBiDimensionFactory>();
            _startValuesBuildingBlock = A.Fake <IMoleculeStartValuesBuildingBlock>();

            _reactionDimensionRetriever = A.Fake <IReactionDimensionRetriever>();

            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol")).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("mmol")).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol/l")).Returns(_concentrationDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("s")).Returns(_timeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("")).Throws <Exception>();

            A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.AMOUNT)).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION)).Returns(_concentrationDimension);

            A.CallTo(() => _reactionDimensionRetriever.SelectedDimensionMode).Returns(ReactionDimensionMode.AmountBased);

            sut = new DataTableToImportQuantityDTOMapperForMolecules(_dimensionFactory, _reactionDimensionRetriever);
        }
 public CreateMoleculeStartValuesPresenter(ICreateStartValuesView view, IMoBiContext context, IMoleculeStartValuesCreator startValuesCreator) : base(view, context)
 {
     _startValuesCreator = startValuesCreator;
     _unallowedNames.AddRange(_context.CurrentProject.MoleculeStartValueBlockCollection.Select(x => x.Name));
     view.ApplicationIcon = ApplicationIcons.MoleculeStartValues;
     view.Caption         = AppConstants.Captions.NewMolculeStartValues;
 }
示例#3
0
 public SpeciesImporter(IObjectPathFactory objectPathFactory, IObjectBaseFactory objectBaseFactory, IMoleculeBuilderFactory moleculeBuilderFactory, IMoleculeStartValuesCreator moleculeStartValuesCreator, IMoBiDimensionFactory moBiDimensionFactory, ASTHandler astHandler, IMoBiContext context)
     : base(objectPathFactory, objectBaseFactory, astHandler, context)
 {
     _moleculeBuilderFactory     = moleculeBuilderFactory;
     _moleculeStartValuesCreator = moleculeStartValuesCreator;
     _moBiDimensionFactory       = moBiDimensionFactory;
     _counter             = 1;
     _dimensionDictionary = new Dictionary <string, Dimension>();
 }
        protected override void Context()
        {
            _context  = A.Fake <IInteractionTaskContext>();
            _editTask = A.Fake <IEditTasksForBuildingBlock <IMoleculeStartValuesBuildingBlock> >();
            _moleculeStartValuesCreator      = A.Fake <IMoleculeStartValuesCreator>();
            _cloneManagerForBuildingBlock    = A.Fake <ICloneManagerForBuildingBlock>();
            _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock();
            _reactionDimensionRetriever      = A.Fake <IReactionDimensionRetriever>();
            _moleculeResolver = A.Fake <IMoleculeResolver>();

            sut = new MoleculeStartValuesTask(_context, _editTask, _moleculeStartValuesCreator,
                                              new ImportedQuantityToMoleculeStartValueMapper(_moleculeStartValuesCreator), A.Fake <IMoleculeStartValueBuildingBlockMergeManager>(), _cloneManagerForBuildingBlock, _reactionDimensionRetriever, A.Fake <IMoBiFormulaTask>(), A.Fake <IMoBiSpatialStructureFactory>(), new MoleculeStartValuePathTask(A.Fake <IFormulaTask>(), _context.Context), _moleculeResolver);
        }
示例#5
0
 public PKSimMoleculeStartValuesCreator(
     IMoleculeStartValuesCreator moleculeStartValuesCreator,
     IMoleculeStartFormulaRepository moleculeStartFormulaRepository,
     IFormulaFactory formulaFactory,
     IModelContainerMoleculeRepository modelContainerMoleculeRepository,
     IEntityPathResolver entityPathResolver)
 {
     _moleculeStartValuesCreator     = moleculeStartValuesCreator;
     _moleculeStartFormulaRepository = moleculeStartFormulaRepository;
     _formulaFactory = formulaFactory;
     _modelContainerMoleculeRepository = modelContainerMoleculeRepository;
     _entityPathResolver = entityPathResolver;
 }
 protected virtual void InitializeSimulation()
 {
     _objectPathFactory          = IoC.Resolve <IObjectPathFactory>();
     _moleculeStartValuesCreator = IoC.Resolve <IMoleculeStartValuesCreator>();
     _buildConfiguration         = IoC.Resolve <ModelHelperForSpecs>().CreateBuildConfiguration();
     _modelConstructor           = IoC.Resolve <IModelConstructor>();
     _result     = _modelConstructor.CreateModelFrom(_buildConfiguration, "MyModel");
     _model      = _result.Model;
     _simulation = new ModelCoreSimulation
     {
         BuildConfiguration = _buildConfiguration,
         Model = _model
     };
 }
示例#7
0
 public PKSimMoleculeStartValuesCreator(IMoleculeStartValuesCreator moleculeStartValuesCreator,
                                        IObjectPathFactory objectPathFactory,
                                        IExpressionContainersRetriever expressionContainersRetriever,
                                        IMoleculeStartFormulaRepository moleculeStartFormulaRepository,
                                        IFormulaFactory formulaFactory,
                                        IModelContainerMoleculeRepository modelContainerMoleculeRepository)
 {
     _moleculeStartValuesCreator     = moleculeStartValuesCreator;
     _objectPathFactory              = objectPathFactory;
     _expressionContainersRetriever  = expressionContainersRetriever;
     _moleculeStartFormulaRepository = moleculeStartFormulaRepository;
     _formulaFactory = formulaFactory;
     _modelContainerMoleculeRepository = modelContainerMoleculeRepository;
 }
示例#8
0
 public MoleculeStartValuesTask(
     IInteractionTaskContext interactionTaskContext,
     IEditTasksForBuildingBlock <IMoleculeStartValuesBuildingBlock> editTask,
     IMoleculeStartValuesCreator startValuesCreator,
     IImportedQuantityToMoleculeStartValueMapper dtoMapper,
     IMoleculeStartValueBuildingBlockMergeManager startValueBuildingBlockMergeManager,
     ICloneManagerForBuildingBlock cloneManagerForBuildingBlock,
     IReactionDimensionRetriever dimensionRetriever,
     IMoBiFormulaTask moBiFormulaTask,
     IMoBiSpatialStructureFactory spatialStructureFactory, IMoleculeStartValuePathTask moleculeStartValuePathTask, IMoleculeResolver moleculeResolver)
     : base(interactionTaskContext, editTask, startValueBuildingBlockMergeManager, cloneManagerForBuildingBlock, moBiFormulaTask, spatialStructureFactory, dtoMapper, moleculeStartValuePathTask)
 {
     _startValuesCreator = startValuesCreator;
     _dimensionRetriever = dimensionRetriever;
     _moleculeResolver   = moleculeResolver;
 }
 public ConcentrationBaseModelHelperForSpecs(IObjectBaseFactory objectBaseFactory, IParameterStartValuesCreator parameterStartValuesCreator, IMoleculeStartValuesCreator moleculeStartValuesCreator,
                                             IObjectPathFactory objectPathFactory, IDimensionFactory dimensionFactory, ISpatialStructureFactory spatialStructureFactory,
                                             IOutputSchemaFactory outputSchemaFactory, IMoleculeBuilderFactory moleculeBuilderFactory,
                                             IReactionDimensionRetriever reactionDimensionRetriever, IModelConstructor modelConstructor, ISolverSettingsFactory solverSettingsFactory)
 {
     _objectBaseFactory             = objectBaseFactory;
     _outputSchemaFactory           = outputSchemaFactory;
     _moleculeBuilderFactory        = moleculeBuilderFactory;
     _modelConstructor              = modelConstructor;
     _solverSettingsFactory         = solverSettingsFactory;
     _reactionDimensionRetriever    = reactionDimensionRetriever.DowncastTo <ReactionDimensionRetrieverForSpecs>();
     _spatialStructureFactory       = spatialStructureFactory;
     _parameterStartValuesCreator   = parameterStartValuesCreator;
     _moleculeStartValuesCreator    = moleculeStartValuesCreator;
     _objectPathFactory             = objectPathFactory;
     _concentrationDimension        = dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION);
     _concentrationPerTimeDimension = dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION_PER_TIME);
     _volumeDimension = dimensionFactory.Dimension(Constants.Dimension.VOLUME);
 }
 public MoleculeStartValuesPresenter(
    IMoleculeStartValuesView view,
    IMoleculeStartValueToMoleculeStartValueDTOMapper startValueMapper,
    IMoleculeIsPresentSelectionPresenter isPresentSelectionPresenter,
    IRefreshStartValueFromOriginalBuildingBlockPresenter refreshStartValuesPresenter,
    IMoleculeNegativeValuesAllowedSelectionPresenter negativeStartValuesAllowedSelectionPresenter,
    IMoleculeStartValuesTask moleculeStartValuesTask,
    IMoleculeStartValuesCreator msvCreator,
    IMoBiContext context,
    ILegendPresenter legendPresenter,
    IDeleteStartValuePresenter deleteStartValuePresenter)
    : base(view, startValueMapper, refreshStartValuesPresenter, moleculeStartValuesTask, msvCreator, context, legendPresenter, deleteStartValuePresenter)
 {
    _moleculeStartValuesTask = moleculeStartValuesTask;
    isPresentSelectionPresenter.ApplySelectionAction = performIsPresentAction;
    negativeStartValuesAllowedSelectionPresenter.ApplySelectionAction = performNegativeValuesAllowedAction;
    _view.AddIsPresentSelectionView(isPresentSelectionPresenter.BaseView);
    _view.AddNegativeValuesAllowedSelectionView(negativeStartValuesAllowedSelectionPresenter.BaseView);
 }
示例#11
0
        protected override void Context()
        {
            _view    = A.Fake <IMoleculeStartValuesView>();
            _mapper  = A.Fake <IMoleculeStartValueToMoleculeStartValueDTOMapper>();
            _context = A.Fake <IMoBiContext>();
            _isPresentSelectionPresenter = A.Fake <IMoleculeIsPresentSelectionPresenter>();
            _refreshStartValuesPresenter = A.Fake <IRefreshStartValueFromOriginalBuildingBlockPresenter>();
            _negativeStartValuesAllowedSelectionPresenter = A.Fake <IMoleculeNegativeValuesAllowedSelectionPresenter>();
            _moleculeStartValueTask     = A.Fake <IMoleculeStartValuesTask>();
            _commandCollector           = A.Fake <ICommandCollector>();
            _deleteStartValuePresenter  = A.Fake <IDeleteStartValuePresenter>();
            _legendPresenter            = A.Fake <ILegendPresenter>();
            _moleculeStartValuesCreator = A.Fake <IMoleculeStartValuesCreator>();
            sut = new MoleculeStartValuesPresenter(
                _view, _mapper, _isPresentSelectionPresenter, _refreshStartValuesPresenter, _negativeStartValuesAllowedSelectionPresenter, _moleculeStartValueTask,
                _moleculeStartValuesCreator, _context, _legendPresenter, _deleteStartValuePresenter);
            _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock();

            sut.InitializeWith(_commandCollector);
        }
 public ImportedQuantityToMoleculeStartValueMapper(IMoleculeStartValuesCreator msvCreator)
 {
     _msvCreator = msvCreator;
 }
 public SimulationHelperForSpecs(IObjectBaseFactory objectBaseFactory, IParameterStartValuesCreator parameterStartValuesCreator, IMoleculeStartValuesCreator moleculeStartValuesCreator, IObjectPathFactory objectPathFactory, IDimensionFactory dimensionFactory, IModelConstructor modelConstructor, ISpatialStructureFactory spatialStructureFactory, INeighborhoodBuilderFactory neighborhoodFactory, IOutputSchemaFactory outputSchemaFactory, IMoleculeBuilderFactory moleculeBuilderFactory, ISolverSettingsFactory solverSettingsFactory)
     : base(objectBaseFactory, parameterStartValuesCreator, moleculeStartValuesCreator, objectPathFactory,
            dimensionFactory, spatialStructureFactory, neighborhoodFactory, outputSchemaFactory, moleculeBuilderFactory, solverSettingsFactory)
 {
     _modelConstructor = modelConstructor;
 }