Ejemplo n.º 1
0
        public void Create_ByTicket()
        {
            Guid typeId = new Guid();
            Type expectedType = typeof(ExportNetworkElement);
            IElementDefinition defType = new ElementDefinition(typeId);

            BlueSpider.Common.Persistance.ElementTicket ticket = new BlueSpider.Common.Persistance.ElementTicket();
            ticket.ElementId = Guid.NewGuid();
            ticket.TypeId = typeId;
            ticket.FxId = Guid.NewGuid();
            ticket.ParamMgrId = Guid.NewGuid();
            ticket.InputPortMgrId = Guid.NewGuid();
            ticket.OutputPortMgrId = Guid.NewGuid();
            ticket.InputPortIds = new Guid[] { Guid.NewGuid()  };
            ticket.OutputPortIds = new Guid[] { };

            ExportNetworkElementFactory fac = new ExportNetworkElementFactory();
            ExportNetworkElement el = fac.Create(ticket, defType);

            Assert.NotNull(el);
            Assert.IsType(expectedType, el);
            Assert.NotNull(el.ParamMgr);
            Assert.NotNull(el.ParamMgr.Bag);
            Assert.NotNull(el.ParamMgr.ParamVarMapper);
            Assert.NotNull(el.InPortMgr);
            Assert.Equal(1, el.InPortMgr.Count);
            Assert.True(el.InPortMgr[0] is BlueSpider.Common.Ports.IInputNetworkPort);
            Assert.NotNull(el.OutPortMgr);
            Assert.Equal(0, el.OutPortMgr.Count);
            Assert.NotNull(el.SettingsMgr);
            Assert.NotNull(el.OptionsMgr);

            Assert.Equal(defType.ElementTypeId, el.TypeId);
            Assert.Equal(ticket.ElementId, el.Id);
            Assert.Equal(ticket.ParamMgrId, el.ParamMgr.Id);
            Assert.Equal(ticket.FxId, el.Fx.Id);
            Assert.Equal(ticket.InputPortIds[0], el.InPortMgr[0].Id);
        }
Ejemplo n.º 2
0
        public void Create_ReturnsAnInstanceOfTheElement()
        {
            Guid id = new Guid();
            Type expectedType = typeof(ExportNetworkElement);
            IElementDefinition defType = new ElementDefinition(Guid.NewGuid());

            ExportNetworkElementFactory fac = new ExportNetworkElementFactory();
            ExportNetworkElement el = fac.Create(id, defType);

            Assert.NotNull(el);
            Assert.IsType(expectedType, el);
            Assert.NotNull(el.ParamMgr);
            Assert.NotNull(el.ParamMgr.Bag);
            Assert.NotNull(el.ParamMgr.ParamVarMapper);
            Assert.NotNull(el.InPortMgr);
            Assert.Equal(1, el.InPortMgr.Count);
            Assert.True(el.InPortMgr[0] is BlueSpider.Common.Ports.IInputNetworkPort);
            Assert.NotNull(el.OutPortMgr);
            Assert.Equal(0, el.OutPortMgr.Count);
            Assert.NotNull(el.SettingsMgr);
            Assert.NotNull(el.OptionsMgr);
            Assert.Equal(el.TypeId, defType.ElementTypeId);
            Assert.Equal(el.Id, id);
        }