protected override void Context()
        {
            base.Context();
            _project = new MoBiProject();
            var molecule          = new MoleculeBuilder().WithName(_moleculeName);
            var moleculeParameter = new Parameter().WithName(_moleculeParameterName);

            molecule.Add(moleculeParameter);
            var molecules = new MoleculeBuildingBlock()
            {
                molecule
            };

            _project.AddBuildingBlock(molecules);
            var parameter = new Parameter().WithName(_parameterName);
            var root      = new Container().WithName("Root");

            root.Add(parameter);
            var spatialStructure = new MoBiSpatialStructure().WithTopContainer(root);

            _project.AddBuildingBlock(spatialStructure);
            var reactionBuilder = new ReactionBuilder().WithName(_reactionName);
            var reactions       = new MoBiReactionBuildingBlock()
            {
                reactionBuilder
            };

            _project.AddBuildingBlock(reactions);

            A.CallTo(() => _context.CurrentProject).Returns(_project);
        }
        private void addEntityToProject(EntityMetaData entity, SerializationContext serializationContext)
        {
            if (entity.IsAnImplementationOf <SimulationMetaData>())
            {
                return;
            }

            var deserializedEntity = deserializeContent <object>(entity.Content, serializationContext);

            if (deserializedEntity.IsAnImplementationOf <CurveChart>())
            {
                addChartToProject(deserializedEntity);
            }

            else if (deserializedEntity.IsAnImplementationOf <ParameterIdentification>())
            {
                _project.AddParameterIdentification(deserializedEntity as ParameterIdentification);
            }

            else if (deserializedEntity.IsAnImplementationOf <SensitivityAnalysis>())
            {
                _project.AddSensitivityAnalysis(deserializedEntity as SensitivityAnalysis);
            }

            else if (deserializedEntity.IsAnImplementationOf <IWithId>())
            {
                _project.AddBuildingBlock(deserializedEntity as IBuildingBlock);
            }

            else
            {
                throw new MoBiException($"Don't know what to do with {deserializedEntity.GetType()}");
            }
        }
        protected override void Context()
        {
            base.Context();
            _project = new MoBiProject();
            var molecule          = new MoleculeBuilder().WithName(_moleculeName);
            var moleculeParameter = new Parameter().WithName(_moleculeParameterName);

            molecule.Add(moleculeParameter);
            var molecules = new MoleculeBuildingBlock()
            {
                molecule
            };

            _project.AddBuildingBlock(molecules);
            var parameter = new Parameter().WithName(_parameterName);
            var root      = new Container().WithName(_topContainerName);

            root.Add(parameter);
            var spatialStructure = new MoBiSpatialStructure().WithTopContainer(root);

            spatialStructure.GlobalMoleculeDependentProperties = new Container().WithName(Constants.MOLECULE_PROPERTIES);
            spatialStructure.NeighborhoodsContainer            = new Container().WithName(Constants.NEIGHBORHOODS);
            _project.AddBuildingBlock(spatialStructure);

            var reactionBuilder = new ReactionBuilder().WithName(_reactionName);
            var reactions       = new MoBiReactionBuildingBlock()
            {
                reactionBuilder
            };

            _project.AddBuildingBlock(reactions);
            _project.AddSimulation(new MoBiSimulation().WithName(_simulationName));
            var eventGroupBuilder       = new EventGroupBuilder().WithName(_eventGroupName);
            var eventGroupBuildingBlock = new EventGroupBuildingBlock();

            eventGroupBuildingBlock.Add(eventGroupBuilder);
            _project.AddBuildingBlock(eventGroupBuildingBlock);


            A.CallTo(() => _context.CurrentProject).Returns(_project);
        }
        protected override void Context()
        {
            base.Context();
            _project = new MoBiProject();
            _observerBuildingBlock           = new ObserverBuildingBlock().WithName("OBSERVERS");
            _simulationSettingsBuildingBlock = new SimulationSettings().WithName("SIMULATION_SETTINGS");
            _simulationSettingsNode          = A.Fake <ITreeNode>();
            _observerBuildingBlockNode       = A.Fake <ITreeNode>();

            _allNodesAdded = new List <ITreeNode>();
            A.CallTo(() => _view.AddNode(A <ITreeNode> ._)).Invokes(x =>
            {
                _allNodesAdded.Add(x.GetArgument <ITreeNode>(0));
            });

            _project.AddBuildingBlock(_observerBuildingBlock);
            _project.AddBuildingBlock(_simulationSettingsBuildingBlock);

            A.CallTo(() => _treeNodeFactory.CreateFor(_simulationSettingsBuildingBlock)).Returns(_simulationSettingsNode);
            A.CallTo(() => _treeNodeFactory.CreateFor(_observerBuildingBlock)).Returns(_observerBuildingBlockNode);
        }
Esempio n. 5
0
        protected override void Context()
        {
            base.Context();
            _moleculeBuildingBlock = new MoleculeBuildingBlock {
                Id = "1"
            };
            _project = new MoBiProject();

            _project.AddBuildingBlock(new MoleculeStartValuesBuildingBlock {
                MoleculeBuildingBlockId = _moleculeBuildingBlock.Id, SpatialStructureId = ""
            });
        }
Esempio n. 6
0
        private void addSimulationSettingsTemplateToProject(IMoBiSimulation mobiSimulation)
        {
            if (!_loadingMoBiSimulation)
            {
                return;
            }
            var simulationSettingsInfo     = mobiSimulation.MoBiBuildConfiguration.SimulationSettingsInfo;
            var templateSimulationSettings = _cloneManager.CloneBuidingBlock(simulationSettingsInfo.BuildingBlock);

            simulationSettingsInfo.TemplateBuildingBlock = templateSimulationSettings;
            _project.AddBuildingBlock(templateSimulationSettings);
        }
Esempio n. 7
0
 private void addjEmptyBBIfneeded(IMoBiProject project)
 {
     project.AddBuildingBlock(new ObserverBuildingBlock().WithName("Empty"));
     if (!project.EventBlockCollection.Any())
     {
         project.AddBuildingBlock(new EventGroupBuildingBlock().WithName("Empty"));
     }
     if (!project.ReactionBlockCollection.Any())
     {
         project.AddBuildingBlock(new MoBiReactionBuildingBlock().WithName("Empty"));
     }
     if (!project.PassiveTransportCollection.Any())
     {
         project.AddBuildingBlock(new PassiveTransportBuildingBlock().WithName("Empty"));
     }
     if (!project.MoleculeStartValueBlockCollection.Any())
     {
         project.AddBuildingBlock(new MoleculeStartValuesBuildingBlock().WithName("Empty"));
     }
     if (!project.ParametersStartValueBlockCollection.Any())
     {
         project.AddBuildingBlock(new ParameterStartValuesBuildingBlock().WithName("Empty"));
     }
 }
Esempio n. 8
0
 private void addToProject(IMoBiProject project)
 {
     project.AddBuildingBlock(_buildingBlock);
 }
Esempio n. 9
0
        private void addSettings(IMoBiProject project, string settingFileName)
        {
            var simulationSettings = IoC.Resolve <ISimulationSettingsFactory>().CreateDefault();

            project.AddBuildingBlock(simulationSettings);
        }
 public void should_add_building_block_to_project()
 {
     A.CallTo(() => _project.AddBuildingBlock(_bb)).MustHaveHappened();
 }