protected override void Context()
 {
     base.Context();
     _newAlias                     = "new_Name";
     _changedObject.Name           = "Name really old";
     _changedName                  = _changedObject.Name;
     _oldAlias                     = "Name_really_old";
     _theFormula                   = new ExplicitFormula(String.Format("k_{0}*{0}", _oldAlias));
     _formulaUsablePathNotToChange = new FormulaUsablePath(new[] { ObjectPath.PARENT_CONTAINER, "BLA", String.Format("k_{0}", _oldAlias) })
     {
         Alias = String.Format("k_{0}", _oldAlias)
     };
     _theFormula.AddObjectPath(_formulaUsablePathNotToChange);
     _formulaUsablePathToChange = new FormulaUsablePath(new[] { ObjectPath.PARENT_CONTAINER, _changedName })
     {
         Alias = _oldAlias
     };
     _theFormula.AddObjectPath(_formulaUsablePathToChange);
     _theFormula.Name = "F1";
     A.CallTo(() => _aliasCreator.CreateAliasFrom(_changedName)).Returns(_oldAlias);
     A.CallTo(() => _aliasCreator.CreateAliasFrom(_newName)).Returns(_newAlias);
     A.CallTo(() => _context.Get <IObjectBase>(A <string> ._)).Returns(_theFormula);
     _moleculeBuildingBlock = new MoleculeBuildingBlock().WithName("M").WithId("M");
     _moleculeBuildingBlock.AddFormula(_theFormula);
 }
Esempio n. 2
0
        protected override void Context()
        {
            base.Context();
            _returnedBuildingBlocks = new List <IBuildingBlock>();
            _childReactionBuilder   = new ReactionBuilder().WithName("Test").WithId("FindME");
            _reactionParameter      = new Parameter().WithName("Para").WithId("ReactionPara");
            _childReactionBuilder.AddParameter(_reactionParameter);
            _reactionBuildingBlock = new MoBiReactionBuildingBlock()
            {
                _childReactionBuilder
            };
            _allBuildingBlocks.Add(_reactionBuildingBlock);
            _moleculeBuilder   = new MoleculeBuilder();
            _moleculeParameter = new Parameter().WithName("para");
            _moleculeBuilder.AddParameter(_moleculeParameter);
            _moleculeBuildingBlock = new MoleculeBuildingBlock()
            {
                _moleculeBuilder
            };
            _allBuildingBlocks.Add(_moleculeBuildingBlock);
            _passiveTranportBuilder    = new TransportBuilder();
            _passiveTransportParameter = new Parameter().WithName("PTParameter");
            _passiveTranportBuilder.AddParameter(_passiveTransportParameter);
            _passiveTranportBuildingBlock = new PassiveTransportBuildingBlock()
            {
                _passiveTranportBuilder
            };
            _allBuildingBlocks.Add(_passiveTranportBuildingBlock);
            _applicationBuilder      = new ApplicationBuilder();
            _eventGroupBuildingBlock = new EventGroupBuildingBlock()
            {
                _applicationBuilder
            };
            _applicationBuilderParameter = new ApplicationBuilder().WithName("AppParameter");
            _applicationBuilder.Add(_applicationBuilderParameter);
            _allBuildingBlocks.Add(_eventGroupBuildingBlock);
            _parameter = new Parameter().WithName("Para");
            var container = new Container().WithName("Cont");

            container.Add(_parameter);
            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            _parameterFactory  = A.Fake <IParameterFactory>();
            A.CallTo(() => _objectBaseFactory.Create <IContainer>()).Returns(new Container());
            A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(new MoBiSpatialStructure());
            var diagramManagerFactory = A.Fake <IDiagramManagerFactory>();

            _spatialStructure = new MoBiSpatialStructureFactory(_objectBaseFactory, _parameterFactory, A.Fake <IIconRepository>(), diagramManagerFactory).Create() as IMoBiSpatialStructure;
            _spatialStructure.AddTopContainer(container);
            _allBuildingBlocks.Add(_spatialStructure);
            _formula = new ExplicitFormula();
            _moleculeBuildingBlock.AddFormula(_formula);
        }
Esempio n. 3
0
        public void Visit(IMoleculeBuildingBlock moleculeBuildingBlock)
        {
            var amountDimension = _context.DimensionFactory.Dimension(Constants.Dimension.AMOUNT);
            var formula         = createTotalDrugMassFormula(amountDimension);

            foreach (var moleculeBuilder in moleculeBuildingBlock)
            {
                moleculeBuilder.Add(
                    createTotalDrugMassParameter(formula, amountDimension));
            }
            updateAllParameters(moleculeBuildingBlock.SelectMany(mb => mb.GetAllChildren <IParameter>()));
            moleculeBuildingBlock.AddFormula(formula);
            _converted = true;
        }
 protected override void Context()
 {
     base.Context();
     _formula      = new ExplicitFormula();
     _formula.Name = _changedName;
     _path         = new FormulaUsablePath(new[] { "A", "B", _changedName })
     {
         Alias = _changedName
     };
     A.CallTo(() => _aliasCreator.CreateAliasFrom(_changedName)).Returns(_changedName);
     A.CallTo(() => _aliasCreator.CreateAliasFrom(_newName)).Returns(_newName);
     _formula.AddObjectPath(_path);
     _moleculeBuildingBlock = new MoleculeBuildingBlock().WithName("M").WithId("M");
     _moleculeBuildingBlock.AddFormula(_formula);
 }
Esempio n. 5
0
        protected override void Context()
        {
            base.Context();
            _returnedBuildingBlocks = new List <IBuildingBlock>();
            _childReactionBuilder   = new ReactionBuilder().WithName("Test").WithId("FindME");
            _reactionBuildingBlock  = new MoBiReactionBuildingBlock()
            {
                _childReactionBuilder
            };
            _allBuildingBlocks.Add(_reactionBuildingBlock);
            _moleculeBuilder       = new MoleculeBuilder();
            _moleculeBuildingBlock = new MoleculeBuildingBlock()
            {
                _moleculeBuilder
            };
            _allBuildingBlocks.Add(_moleculeBuildingBlock);
            _obseverBuilder        = new ObserverBuilder();
            _observerBuildingBlock = new ObserverBuildingBlock()
            {
                _obseverBuilder
            };
            _allBuildingBlocks.Add(_observerBuildingBlock);
            _passiveTranportBuilder       = new TransportBuilder();
            _passiveTranportBuildingBlock = new PassiveTransportBuildingBlock()
            {
                _passiveTranportBuilder
            };
            _allBuildingBlocks.Add(_passiveTranportBuildingBlock);
            _applicationBuilder      = new ApplicationBuilder();
            _eventGroupBuildingBlock = new EventGroupBuildingBlock()
            {
                _applicationBuilder
            };
            _allBuildingBlocks.Add(_eventGroupBuildingBlock);
            _parameter = new Parameter().WithName("Para");
            var container = new Container().WithName("Cont");

            container.Add(_parameter);
            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            _parmaeterFactory  = A.Fake <IParameterFactory>();
            A.CallTo(() => _objectBaseFactory.Create <IContainer>()).Returns(A.Fake <IContainer>());
            A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(new MoBiSpatialStructure());
            var diagramManagerFactory = A.Fake <IDiagramManagerFactory>();

            _spatialStructure = new MoBiSpatialStructureFactory(_objectBaseFactory, _parmaeterFactory, A.Fake <IconRepository>(), diagramManagerFactory).Create().DowncastTo <IMoBiSpatialStructure>();
            _spatialStructure.AddTopContainer(container);
            _allBuildingBlocks.Add(_spatialStructure);
            _formula = new ExplicitFormula();
            _moleculeBuildingBlock.AddFormula(_formula);
            _parameterStartValue = new ParameterStartValue {
                Path = new ObjectPath {
                    "test"
                }, StartValue = 1, Dimension = A.Fake <IDimension>()
            };
            _parameterStartValueBuildingBlock = new ParameterStartValuesBuildingBlock()
            {
                _parameterStartValue
            };
            _allBuildingBlocks.Add(_parameterStartValueBuildingBlock);
            _moleculeStartValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath {
                    "test"
                }, Name = "drug"
            };
            _moleculeStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock()
            {
                _moleculeStartValue
            };
            _allBuildingBlocks.Add(_moleculeStartValuesBuildingBlock);
        }