Ejemplo n.º 1
0
        public void ChannelPipeline_should_add_item_to_head()
        {
            var pipeline     = new DefaultChannelPipeline(TestChannel.Instance);
            var namedChannel = new NamedChannelHandler("TEST");

            pipeline.AddFirst(namedChannel.Name, namedChannel);
            var count = pipeline.Count();

            Assert.Equal(3, count); // 1 for head, 1 for named channel, 1 for tail
        }
Ejemplo n.º 2
0
        public void PipelineModel_should_no_longer_detect_named_nodes_removed_from_tail()
        {
            var namedChannel = new NamedChannelHandler("TEST");
            var node         = new PipelineModelNode {
                Handler = namedChannel, Name = namedChannel.Name
            };
            var pipelineModel = PipelineMutationModel.Fresh();

            pipelineModel = AddToTail(pipelineModel, node);
            Assert.True(pipelineModel.Contains(node.Name));
            pipelineModel = RemoveTail(pipelineModel);
            Assert.False(pipelineModel.Contains(namedChannel.Name));
        }
Ejemplo n.º 3
0
 protected Property CheckEventInQueue(NamedChannelHandler mFirst, SupportedEvent e, Property prop,
                                      Queue <Tuple <string, SupportedEvent> > eventQueue)
 {
     if (mFirst.SupportsEvent(e))
     {
         var outcome =
             eventQueue.SequenceEqual(new[]
                                      { new Tuple <string, SupportedEvent>(mFirst.Name, e) });
         prop = prop.And(() => outcome)
                .Label(
             $"[{GetType()}] {mFirst} {(mFirst.SupportsEvent(e) ? "does" : "does not")} support {e}, but found that queue contained {string.Join(",", eventQueue)}");
     }
     return(prop);
 }
Ejemplo n.º 4
0
        public void PipelineModel_should_detect_named_nodes_added_to_tail()
        {
            var namedChannel  = new NamedChannelHandler("TEST");
            var namedChannel2 = new NamedChannelHandler("TEST2");
            var node          = new PipelineModelNode {
                Handler = namedChannel, Name = namedChannel.Name
            };
            var pipelineModel = PipelineMutationModel.Fresh();

            pipelineModel = AddToTail(pipelineModel, node);
            Assert.True(pipelineModel.Contains(node.Name));
            var node2 = new PipelineModelNode {
                Handler = namedChannel2, Name = namedChannel2.Name
            };

            pipelineModel = AddToTail(pipelineModel, node2);
            Assert.True(pipelineModel.Contains(node.Name));
            Assert.True(pipelineModel.Contains(node2.Name));
        }
Ejemplo n.º 5
0
        public Property DefaultNamedChannelHandler_should_not_support_any_events(SupportedEvent[] events)
        {
            var handler = new NamedChannelHandler("foo");

            return(events.All(x => !handler.SupportsEvent(x)).ToProperty());
        }
Ejemplo n.º 6
0
 public static Gen <Operation <IChannelPipeline, PipelineMutationModel> > AddLastGen()
 {
     return
         (NamedChannelHandler.AllHandlers()
          .Select(x => (Operation <IChannelPipeline, PipelineMutationModel>) new AddLast(x)));
 }
Ejemplo n.º 7
0
 public AddLast(NamedChannelHandler handler) : base(handler)
 {
 }
Ejemplo n.º 8
0
 protected AddHandler(NamedChannelHandler handler)
 {
     Handler = handler;
     Name    = Handler.Name;
 }