public ExportNetworkElement Create(Guid id, IElementDefinition defType)
        {
            ExportNetworkElement el = new ExportNetworkElement(id, defType);

            IInputPortMgr inPortMgr = CreateInputPortMgr(el);
            IOutputPortMgr outPortMgr = CreateOutputPortMgr(el);

            el.InPortMgr = inPortMgr;
            el.OutPortMgr = outPortMgr;

            IExportNetworkParamMgr paramMgr = CreateParamMgr();
            el.ParamMgr = paramMgr;

            Guid fxId = Guid.NewGuid();
            IExportNetworkFx fx = CreateMyFx(fxId, id);
            el.Fx = fx;

            using (var fac = new SettingsMgrFactory())
            {
                ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el);
                el.SettingsMgr = settingsMgr;
            }

            using (var fac = new OptionsMgrFactory())
            {
                ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el);
                el.OptionsMgr = optsMgr;
            }

            return el;
        }
Example #2
0
        public void SetIsSelected_Does_Not_Fire_The_SelectionChangedEvent_If_The_SelectionValue_Does_Not_Change()
        {
            var element = new ExportNetworkElement();
            SelectionSource source = SelectionSource.Code;
            SelectionOrigin origin = SelectionOrigin.Business;

            var helper = new HelperForElements();
            element.SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(helper.SelectionChanged_DummyHandler);

            element.SetIsSelected(false, source, origin);
            Assert.False(element.IsSelected);
            Assert.Equal(0, helper.SelectionChanged_TimesCalled);
        }
Example #3
0
        public void RequestVariableValuesForParamValidation_FiresRequestVariableValuesEvent()
        {
            var element = new ExportNetworkElement();
            var mockParamMgr = new Moq.Mock<IExportNetworkParamMgr>();
            var helper = new HelperForElements();
            string[] varNames = { "Var A", "Var B" };

            element.RequestVariableValues += new RequestVariableValuesEventHandler<IElement>(helper.RequestVariableValues_DummyHandler);

            mockParamMgr.Setup(m => m.VarNamesDependedUpon).Returns(varNames);

            element.ParamMgr = mockParamMgr.Object;
            element.UpdateVariableValuesForParamValidation();
            Assert.Equal(1, helper.RequestVariableValues_TimesCalled);
        }
        public ExportNetworkElement Create(IElementTicket ticket, IElementDefinition defType)
        {
            if (ticket.TypeId != defType.ElementTypeId)
            {
                // TODO
                throw new InvalidOperationException(String.Format(Resources.MssgTicketTypeIdDoesNotMatchDefTypeId, ticket.TypeId, defType.ElementTypeId));
            }

            ExportNetworkElement el = new ExportNetworkElement(ticket.ElementId, defType);

            IInputPortMgr inPortMgr = CreateInputPortMgr(el, ticket.InputPortMgrId, ticket.InputPortIds[0]);
            IOutputPortMgr outPortMgr = CreateOutputPortMgr(el);

            el.InPortMgr = inPortMgr;
            el.OutPortMgr = outPortMgr;

            IExportNetworkParamMgr paramMgr = CreateParamMgr(ticket.ParamMgrId);
            el.ParamMgr = paramMgr;

            IExportNetworkFx fx = CreateMyFx(ticket.FxId, ticket.ElementId);
            el.Fx = fx;

            using (var fac = new SettingsMgrFactory())
            {
                ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el);
                el.SettingsMgr = settingsMgr;
            }

            using (var fac = new OptionsMgrFactory())
            {
                ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el);
                el.OptionsMgr = optsMgr;
            }

            return el;
        }
Example #5
0
        public void SetIsSelected_Updates_The_Is_Selected_Flag_If_The_Value_Changes()
        {
            var element = new ExportNetworkElement();
            // origin will not effect of the flag is updated. ,just may not allow the event to be fired.
            SelectionOrigin origin = SelectionOrigin.None;

            var helper = new HelperForElements();
            element.SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(helper.SelectionChanged_DummyHandler);

            Assert.False(element.IsSelected);
            element.SetIsSelected(true, SelectionSource.Mouse, origin);
            Assert.True(element.IsSelected);
            Assert.Equal(0, helper.SelectionChanged_TimesCalled);
        }