Exemplo n.º 1
0
        private void addInteractionParameters(Compound compound, IMoleculeBuilder drug, InteractionProperties interactionProperties)
        {
            foreach (var interactionProcess in compound.AllProcesses <InteractionProcess>())
            {
                if (!shouldGenerateInteractionContainer(interactionProperties, interactionProcess))
                {
                    continue;
                }

                var interactionContainer = _objectBaseFactory.Create <InteractionContainer>()
                                           .WithIcon(interactionProcess.Icon)
                                           .WithName(interactionProcess.InternalName);

                //only add global pamrameters to the intercation container
                _parameterContainerTask.AddProcessBuilderParametersTo(interactionContainer);
                _parameterSetUpdater.UpdateValuesByName(interactionProcess, interactionContainer);
                interactionContainer.Name = interactionProcess.Name;
                drug.AddInteractionContainer(interactionContainer);
            }
        }
        protected override void Context()
        {
            base.Context();
            _para            = new Parameter().WithName("Para1");
            _moleculeBuilder = new MoleculeBuilder().WithName("Molecule");
            var interactionContainer = new InteractionContainer().WithName("Interaction");

            _moleculeBuilder.AddInteractionContainer(interactionContainer);

            A.CallTo(() => _containerTask.CreateOrRetrieveSubContainerByName(A <IContainer> ._, A <string> ._))
            .ReturnsLazily(x =>
            {
                var parent    = x.GetArgument <IContainer>(0);
                var container = new Container().WithName(x.GetArgument <string>(1));
                parent.Add(container);
                return(container);
            });

            A.CallTo(_parameterCollectionMapper).WithReturnType <IEnumerable <IParameter> >().Returns(new[] { _para });
        }