protected override void Context() { base.Context(); _eventGroupBuildingBlock = new EventGroupBuildingBlock(); _eventGroup = new EventGroupBuilder().WithName("EG"); _eventGroupBuildingBlock.Add(_eventGroup); var parameter = new Parameter().WithName("P1").WithParentContainer(_eventGroup); }
protected override void Context() { base.Context(); var eg1 = new EventGroupBuilder().WithName("Events"); var e1 = new EventBuilder().WithName("Start").WithParentContainer(eg1); var eg2 = new EventGroupBuilder().WithName("Events"); var e2 = new EventBuilder().WithName("Stop").WithParentContainer(eg2); _object1 = eg1; _object2 = eg2; }
protected override void Context() { base.Context(); var eg1 = new EventGroupBuilder().WithName("Events"); var e1 = new EventBuilder().WithName("Start").WithParentContainer(eg1); eg1.SourceCriteria = Create.Criteria(x => x.With("A").And.Not("B")); var eg2 = new EventGroupBuilder().WithName("Events"); var e2 = new EventBuilder().WithName("Start").WithParentContainer(eg2); eg2.SourceCriteria = Create.Criteria(x => x.With("B").And.Not("A")); _object1 = eg1; _object2 = eg2; }
/// <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); }
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; }
protected override void Context() { base.Context(); _eventGroupBuildingBlock = new EventGroupBuildingBlock(); var eventGroup = new EventGroupBuilder().WithName("EG"); _eventGroupBuildingBlock.Add(eventGroup); var ehcStartEvent = new EventBuilder().WithName(Converter321To331.EHCStartEvent); eventGroup.Add(ehcStartEvent); var eabOldStart = new EventAssignmentBuilder().WithName("EAB1").WithFormula(new ExplicitFormula("ln(2) / EHC_Halftime * M * EHC_EjectionFraction")); eabOldStart.UseAsValue = false; eabOldStart.ObjectPath = new ObjectPath(new[] { "Organism", "Gallbladder", "Gallbladder emptying rate" }); ehcStartEvent.AddAssignment(eabOldStart); var assignmentBuilder = new EventAssignmentBuilder().WithName("EAB2").WithFormula(new ExplicitFormula("DontChange")); assignmentBuilder.ObjectPath = new ObjectPath(new[] { "PATH" }); ehcStartEvent.AddAssignment(assignmentBuilder); var ehcStopEvent = new EventBuilder().WithName(Converter321To331.EHCStopEvent); var eabOldStop = new EventAssignmentBuilder().WithName("EAB1").WithFormula(new ConstantFormula(0)); eabOldStop.UseAsValue = false; eabOldStop.ObjectPath = new ObjectPath(new[] { "Organism", "Gallbladder", "Gallbladder emptying rate" }); ehcStopEvent.AddAssignment(eabOldStop); assignmentBuilder = new EventAssignmentBuilder().WithName("EAB2").WithFormula(new ExplicitFormula("DontChange")); assignmentBuilder.ObjectPath = new ObjectPath(new[] { "PATH" }); ehcStopEvent.AddAssignment(assignmentBuilder); eventGroup.Add(ehcStopEvent); var protocolSchemaItem = new Container().WithName("ProtocolSchemaItem").WithParentContainer(eventGroup); _drugMassParameter = new Parameter().WithName("DrugMass").WithParentContainer(protocolSchemaItem).WithValue(1); applications = new EventGroupBuilder().WithName("Applications"); applications.Add(new Parameter().WithName("TotalDrugMass")); _eventGroupBuildingBlock.Add(applications); }
public void TestSerialization() { EventGroupBuilder x1 = CreateObject <EventGroupBuilder>().WithName("Evan.Builder"); x1.EventGroupType = "IV Bolus"; IFormula f1 = CreateObject <ConstantFormula>().WithValue(2.3); IFormula f2 = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(3.4); IParameter p1 = CreateObject <Parameter>().WithName("Patricia").WithFormula(f1).WithValue(3.1); IParameter p2 = CreateObject <Parameter>().WithName("Pascal").WithFormula(f1).WithValue(3.2); x1.Add(p1); x1.Add(p2); EventBuilder eb1 = CreateObject <EventBuilder>().WithName("Eve.Builder").WithDimension(DimensionLength).WithFormula(f1); EventBuilder eb2 = CreateObject <EventBuilder>().WithName("Eva.Builder").WithDimension(DimensionLength).WithFormula(f2); eb2.OneTime = true; x1.Add(eb1); x1.Add(eb2); ApplicationBuilder a1 = CreateObject <ApplicationBuilder>().WithName("App.Builder"); x1.Add(a1); var applicationMoleculeBuilder = CreateObject <ApplicationMoleculeBuilder>().WithName("AppMolecule"); applicationMoleculeBuilder.Formula = f2; applicationMoleculeBuilder.RelativeContainerPath = new ObjectPath(new[] { "A", "B" }); a1.AddMolecule(applicationMoleculeBuilder); a1.AddTransport(CreateObject <TransportBuilder>().WithName("PassiveTranport").WithFormula(f1)); IEventGroupBuilder x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualEventGroupBuilder(x1, x2); }
protected override void Context() { base.Context(); var eg1 = new EventGroupBuilder().WithName("Events"); var app1 = new ApplicationBuilder().WithName("App").WithParentContainer(eg1); app1.MoleculeName = "Drug"; var c1 = new Container().WithName("ProtocolSchemaItem").WithParentContainer(app1); _e1 = new EventBuilder().WithName("Event").WithParentContainer(app1); _eventAssignmentBuilder1 = new EventAssignmentBuilder(); _eventAssignmentBuilder1.ObjectPath = new ObjectPath("Sim|A|B|C"); _eventAssignmentBuilder1.Name = "EAB"; _eventAssignmentBuilder1.UseAsValue = true; _eventAssignmentBuilder1.Formula = new ExplicitFormula("a+b"); _e1.AddAssignment(_eventAssignmentBuilder1); _explicitFormula1 = new ExplicitFormula("1+2"); _p1 = new Parameter().WithName("P").WithFormula(_explicitFormula1).WithParentContainer(c1); var eg2 = new EventGroupBuilder().WithName("Events"); var app2 = new ApplicationBuilder().WithName("App").WithParentContainer(eg2); app2.MoleculeName = "Drug"; var c2 = new Container().WithName("ProtocolSchemaItem").WithParentContainer(app2); var e2 = new EventBuilder().WithName("Event").WithParentContainer(app2); var eventAssignmentBuilder2 = new EventAssignmentBuilder(); eventAssignmentBuilder2.ObjectPath = new ObjectPath("Sim|A|B|C"); eventAssignmentBuilder2.Name = "EAB"; eventAssignmentBuilder2.UseAsValue = false; eventAssignmentBuilder2.Formula = new ExplicitFormula("a+b"); e2.AddAssignment(eventAssignmentBuilder2); var p2 = new Parameter().WithName("P").WithFormula(new ExplicitFormula("2+1")).WithParentContainer(c2); _object1 = eg1; _object2 = eg2; }