Exemplo n.º 1
0
        protected override void Context()
        {
            base.Context();
            _eventGroupBuildingBlock = new EventGroupBuildingBlock().WithName("Tada");
            _eventGroupBuildingBlock.Add(new ApplicationBuilder().WithName("App1"));
            _eventGroupBuildingBlock.Add(new ApplicationBuilder().WithName("App2"));
            _eventGroupBuildingBlock.Add(new EventGroupBuilder().WithName("EG1"));
            _allNames = _eventGroupBuildingBlock.Select(x => x.Name).ToArray();

            A.CallTo(() => _interactionTaskContext.Active <IEventGroupBuildingBlock>()).Returns(_eventGroupBuildingBlock);
        }
        protected override void Context()
        {
            base.Context();
            var observerBuildingBlock1          = new EventGroupBuildingBlock().WithName("Tada");
            IEventGroupBuilder observerBuilderA = new ApplicationBuilder().WithName("EGA");
            var observerBuilderB = new ApplicationBuilder().WithName("EGB");

            observerBuildingBlock1.Add(observerBuilderA);
            observerBuildingBlock1.Add(observerBuilderB);

            var observerBuildingBlock2 = new EventGroupBuildingBlock().WithName("Tada");

            observerBuilderA = new EventGroupBuilder().WithName("EGA");
            observerBuilderB = new ApplicationBuilder().WithName("EGB");

            observerBuildingBlock2.Add(observerBuilderA);
            observerBuildingBlock2.Add(observerBuilderB);

            _object1 = observerBuildingBlock1;
            _object2 = observerBuildingBlock2;
        }
        public void TestComplexEventGroupBB()
        {
            EventGroupBuildingBlock x1 = _buildConfiguration.EventGroups as EventGroupBuildingBlock;

            Assert.IsNotNull(x1);
            ApplicationBuilder a1 = CreateObject <ApplicationBuilder>().WithName("App.Builder");

            x1.Add(a1);
            var      applicationMoleculeBuilder = CreateObject <ApplicationMoleculeBuilder>().WithName("AppMolecule");
            IFormula f2 = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(3.4);

            applicationMoleculeBuilder.Formula = f2;
            applicationMoleculeBuilder.RelativeContainerPath = new ObjectPath(new[] { "A", "B" });
            a1.AddMolecule(applicationMoleculeBuilder);
            IEventGroupBuildingBlock x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualBuildingBlock(x2, x1);
        }
Exemplo n.º 4
0
        /// <summary>
        ///    Creates a EventGroupBuildingBlock and a EventGroupBuilder.
        /// </summary>
        internal void CreateEGBandEGBB()
        {
            EventGroupBuilder = new EventGroupBuilder()
                                .WithName(SBMLConstants.SBML_EVENTS)
                                .WithId(SBMLConstants.SBML_EVENTS);

            var eventsContainer = GetEventsTopContainer();

            if (eventsContainer != null)
            {
                var matchTag = new MatchTagCondition(eventsContainer.Name);
                EventGroupBuilder.SourceCriteria.Add(matchTag);
            }

            EventGroupBuildingBlock = new EventGroupBuildingBlock()
                                      .WithName(SBMLConstants.SBML_EVENT_BB)
                                      .WithId(SBMLConstants.SBML_EVENT_BB);
            EventGroupBuildingBlock.Add(EventGroupBuilder);
        }
        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);
        }