private void createReactionLink(ReactionLinkType type, ReactionNode reactionNode, IMoleculeNode moleculeNode) { var reactionLink = new ReactionLink(); reactionLink.Initialize(type, reactionNode, moleculeNode); reactionLink.SetColorFrom(DiagramOptions.DiagramColors); }
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)); }