Example #1
0
        public void CreateOptionsMgr_For_Network_Pipe()
        {
            //Arrange
            PipeFactory pfac = new PipeFactory();
            INetworkPipe pipe = pfac.CreateNetworkPipe();

            OptionsMgrFactory fac = new OptionsMgrFactory();

            //Act
            IPipeOptionsMgr mgr = fac.CreateOptionsMgr(pipe);

            //Assert
            Assert.NotNull(mgr);
            Assert.IsType(typeof(PipeOptionsMgr), mgr);
        }
Example #2
0
        public void CreateSettingsMgr_For_Network_Pipe()
        {
            //Arrange
            var pfac = new PipeFactory();
            INetworkPipe pipe = pfac.CreateNetworkPipe();

            var fac = new SettingsMgrFactory();

            //Act
            IPipeSettingsMgr mgr = fac.CreateSettingsMgr(pipe);

            //Assert
            Assert.NotNull(mgr);
            Assert.IsType(typeof(PipeSettingsMgr), mgr);
        }
Example #3
0
        public void CreateNeutralPipe()
        {
            //Arrange
            Guid id = Guid.NewGuid();

            Type expectedType = typeof(NeutralPipe);
            var fac = new PipeFactory();

            //Act
            INeutralPipe iPipe = fac.CreateNeutralPipe(id);

            //Assert
            Assert.NotNull(iPipe);

            NeutralPipe pipe = iPipe as NeutralPipe;

            Assert.NotNull(pipe);
            Assert.IsType(expectedType, pipe);
            Assert.NotNull(pipe.SettingsMgr);
            Assert.NotNull(pipe.OptionsMgr);
            Assert.Equal(id, pipe.Id);
        }
 public OutputPortMgrIntegrationWithOutputPortsFixture()
 {
     _pipeFactory = new PipeFactory();
 }
Example #5
0
        public bool Connect()
        {
            bool result = false;
            if (IsInitialPortSet && IsFinalPortSet)
            {
                OnConnectionCreating(new PlumbingEventArgs(PlumbingAction.Initiate));
                if (NetworkPipe == null)
                {
                    //TODO use container
                    using (PipeFactory pf = new PipeFactory())
                    {
                        NetworkPipe = pf.CreateNetworkPipe();
                    }
                }

                SourceNetworkPort.Add(NetworkPipe);
                NetworkPipe.SourceNetworkPort = SourceNetworkPort;
                DestinationNetworkPort.InboundPipe = NetworkPipe;
                NetworkPipe.DestinationNetworkPort = DestinationNetworkPort;
                OnConnectionCreated(new PlumbingEventArgs(PlumbingAction.Complete));
                result = true;
            }

            return result;
        }
Example #6
0
 internal INetworkPipe CreateNetworkPipeModel(Guid id)
 {
     INetworkPipe pipe = null;
     using (PipeFactory fac = new PipeFactory())
     {
         pipe = fac.CreateNetworkPipe(id);
     }
     return pipe;
 }
Example #7
0
        public bool Connect()
        {
            bool result = false;
            if (IsInitialPortSet && IsFinalPortSet)
            {
                OnConnectionCreating(new PlumbingEventArgs(PlumbingAction.Initiate));
                if (DataPipe == null)
                {
                    // allow for mocking
                    //TODO use container
                    PipeFactory pf = new PipeFactory();
                    DataPipe = pf.CreateDataPipe();
                }

                SourceDataPort.Add(DataPipe);
                DataPipe.SourceDataPort = SourceDataPort;
                DestinationDataPort.InboundPipe = DataPipe;
                DataPipe.DestinationDataPort = DestinationDataPort;
                OnConnectionCreated(new PlumbingEventArgs(PlumbingAction.Complete));
                result = true;
            }

            return result;
        }
Example #8
0
        internal IPipe ReConstitute(IPipeTicket ticket)
        {
            IPipe pipe = null;

            //TODO - should use container here
            using (PipeFactory fac = new PipeFactory())
            {
                if (ticket.ContentType == BlobType.Data)
                    pipe = fac.CreateDataPipe(ticket.PipeId);
                else if (ticket.ContentType == BlobType.Network)
                    pipe = fac.CreateNetworkPipe(ticket.PipeId);
            }

            return pipe;
        }