protected override void Context() { base.Context(); var displayUnitRetriever = IoC.Resolve <IDisplayUnitRetriever>(); var f1 = new ExplicitFormula("CL*conc").WithName("formula"); var r1 = new ReactionBuilder().WithName("Reaction").WithFormula(f1); r1.AddEduct(new ReactionPartnerBuilder("Drug", 1)); r1.AddEduct(new ReactionPartnerBuilder("Metab", 1)); r1.AddModifier("Cyp"); var concentrationDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs(); var p1Formula = new ConstantFormula(2).WithDimension(concentrationDimension); var p11 = new Parameter().WithName("P1").WithFormula(p1Formula).WithParentContainer(r1); var f2 = new ExplicitFormula("CL*conc").WithName("formula"); var r2 = new ReactionBuilder().WithName("Reaction").WithFormula(f2); r2.AddEduct(new ReactionPartnerBuilder("Drug", 1)); r2.AddEduct(new ReactionPartnerBuilder("Metab", 1)); r2.AddModifier("Cyp"); var p12Forumla = new ConstantFormula(3).WithDimension(concentrationDimension); var p12 = new Parameter().WithName("P1").WithFormula(p12Forumla).WithParentContainer(r2); _object1 = r1; _object2 = r2; _preferredUnit = concentrationDimension.Units.ElementAt(0); A.CallTo(() => displayUnitRetriever.PreferredUnitFor(p1Formula, null)).Returns(_preferredUnit); A.CallTo(() => displayUnitRetriever.PreferredUnitFor(p12Forumla, null)).Returns(_preferredUnit); }
protected override void Context() { _simulation = new ModelCoreSimulation(); var root = new Container(); root.Add(new EventGroup()); _simulation.Model = new Model(); _simulation.Model.Root = root; _simulation.BuildConfiguration = new BuildConfiguration(); var reactionBuildingBlock = new ReactionBuildingBlock(); var reactionAtoB = new ReactionBuilder(); var reactionBtoA = new ReactionBuilder(); var partnerA = new ReactionPartnerBuilder("A", 0); var partnerB = new ReactionPartnerBuilder("B", 0); //Making both reactions dependent on each other reactionAtoB.AddProduct(partnerA); reactionBtoA.AddProduct(partnerB); reactionAtoB.AddEduct(partnerB); reactionBtoA.AddEduct(partnerA); reactionBuildingBlock.Add(reactionAtoB); reactionBuildingBlock.Add(reactionBtoA); _simulation.BuildConfiguration.Reactions = reactionBuildingBlock; }
protected IReactionBuilder CreateReactionForCompoundAndMetabolite(string[] products, params string[] educts) { var reaction = new ReactionBuilder(); educts.Each(educt => reaction.AddEduct(new ReactionPartnerBuilder(educt, 1))); products.Each(product => reaction.AddProduct(new ReactionPartnerBuilder(product, 1))); return(reaction); }
protected ReactionBuilder createReaction() { var reaction = new ReactionBuilder(); reaction.AddEduct(new ReactionPartnerBuilder("educt", 1.0)); reaction.AddProduct(new ReactionPartnerBuilder("product", 1.0)); reaction.AddModifier("modifier"); return(reaction); }
protected override void Context() { base.Context(); var f1 = new ExplicitFormula("CL*conc").WithName("formula"); var r1 = new ReactionBuilder().WithName("Reaction").WithFormula(f1); r1.AddEduct(new ReactionPartnerBuilder("Drug", 1)); r1.AddEduct(new ReactionPartnerBuilder("Metab", 1)); r1.AddModifier("Cyp"); var p11 = new Parameter().WithName("P1").WithFormula(new ConstantFormula(2)).WithParentContainer(r1); var f2 = new ExplicitFormula("CL*conc").WithName("formula"); var r2 = new ReactionBuilder().WithName("Reaction").WithFormula(f2); r2.AddEduct(new ReactionPartnerBuilder("Drug", 1)); r2.AddEduct(new ReactionPartnerBuilder("Metab2", 1)); r2.AddModifier("Cyp"); var p12 = new Parameter().WithName("P1").WithFormula(new ConstantFormula(2)).WithParentContainer(r2); _object1 = r1; _object2 = r2; }
private IEnumerable <IReactionBuilder> getReactions() { var r1 = new ReactionBuilder(); r1.AddEduct(new ReactionPartnerBuilder("C", 2.0)); r1.AddProduct(new ReactionPartnerBuilder("D1", 1.0)); r1.Name = "name"; r1.WithKinetic(new ExplicitFormula("k1*C")); r1.Description = "description"; yield return(r1); yield return(A.Fake <IReactionBuilder>()); }
protected override void Context() { base.Context(); _reactionBuildingBlock = new MoBiReactionBuildingBlock { DiagramModel = new DiagramModel(), DiagramManager = new MoBiReactionDiagramManager() }; _moBiReactionDiagramManager = _reactionBuildingBlock.DiagramManager.DowncastTo <IReactionDiagramManager <IMoBiReactionBuildingBlock> >(); _moBiReactionDiagramManager.InitializeWith(_reactionBuildingBlock, A.Fake <IDiagramOptions>()); _molecule = new MoleculeBuilder().WithId("moleculeId").WithName("moleculeName"); _reaction = new ReactionBuilder().WithId("reactionId"); _reaction.AddEduct(new ReactionPartnerBuilder(_molecule.Name, 1.0)); _reactionBuildingBlock.Add(_reaction); _moBiReactionDiagramManager.AddObjectBase(_reaction); _moBiReactionDiagramManager.AddMolecule(_reaction, "moleculeName"); _moleculeNode = _moBiReactionDiagramManager.GetMoleculeNodes("moleculeName").FirstOrDefault(); _reactionNode = _moBiReactionDiagramManager.PkModel.DiagramModel.GetAllChildren <ReactionNode>().FirstOrDefault(); _interactionTask = A.Fake <IInteractionTasksForChildren <IMoBiReactionBuildingBlock, IReactionBuilder> >(); _activeSubjectRetriever = A.Fake <IActiveSubjectRetriever>(); var reactionLink = new ReactionLink(); reactionLink.Initialize(ReactionLinkType.Educt, _reactionNode, _moleculeNode); sut.Edit(_reactionBuildingBlock); var removeReactionCommand = new RemoveCommandFor <IMoBiReactionBuildingBlock, IReactionBuilder>(_interactionTask, _moBiContext, _activeSubjectRetriever); A.CallTo(() => _moBiContext.Get <IReactionBuilder>(_reaction.Id)).Returns(_reaction); A.CallTo(() => _moBiContext.Resolve <RemoveCommandFor <IMoBiReactionBuildingBlock, IReactionBuilder> >()).Returns(removeReactionCommand); A.CallTo(() => _activeSubjectRetriever.Active <IBuildingBlock>()).Returns(_reactionBuildingBlock); A.CallTo(() => _interactionTask.Remove(_reaction, _reactionBuildingBlock, _reactionBuildingBlock, A <bool> ._)).Invokes(x => _reactionBuildingBlock.Remove(_reaction)); }