Esempio n. 1
0
            public override Property Check(IChannelPipeline obj0, PipelineMutationModel obj1)
            {
                var removed         = obj0.RemoveLast() as NamedChannelHandler;
                var embeddedChannel = obj0.Channel() as EmbeddedChannel;

                Contract.Assert(embeddedChannel != null);
                embeddedChannel.RunPendingTasks();            // force the pipeline to run all scheduled tasks
                var pFirst  = obj0.Reverse().Skip(1).First(); //bypass the head node
                var mFirst  = obj1.Tail.Previous.Handler;
                var pLength = obj0.Count();
                var prop    = (pFirst == mFirst)
                              .Label($"Expected tail of pipeline to be {mFirst}, was {pFirst}")
                              .And(() => pLength == obj1.Length)
                              .Label($"Expected length of pipeline to be {obj1.Length}, was {pLength}");

                /*
                 * This one is weird, because we don't have a reference to the removed handler on the model anymore.
                 * So we compare the result to what was expected from the handler instead.
                 */
                if (removed != null && removed.SupportsEvent(SupportedEvent.HandlerRemoved))
                {
                    prop = prop.And(() => removed.LastFiredEvent == SupportedEvent.HandlerRemoved)
                           .Label(
                        $"Expected last fired property of handler to be {SupportedEvent.HandlerRemoved}, but was {removed.LastFiredEvent}");
                }

                return(prop);
            }
Esempio n. 2
0
            protected Queue <Tuple <string, SupportedEvent> > Execute(IChannelPipeline pipeline)
            {
                ExecuteInternal(pipeline);
                var embeddedChannel = pipeline.Channel() as EmbeddedChannel;

                Contract.Assert(embeddedChannel != null);
                embeddedChannel.RunPendingTasks();
                return(LastEventHistory(pipeline));
            }
        protected AbstractChannelHandlerContext(IChannelPipeline pipeline, IChannelHandlerInvoker invoker,
                                                string name, PropagationDirections skipPropagationDirections)
        {
            Contract.Requires(pipeline != null);
            Contract.Requires(name != null);

            this.Channel = pipeline.Channel();
            this.invoker = invoker;
            this.skipPropagationFlags = skipPropagationDirections;
            this.Name = name;
        }
        protected AbstractChannelHandlerContext(IChannelPipeline pipeline, IChannelHandlerInvoker invoker,
            string name, PropagationDirections skipPropagationDirections)
        {
            Contract.Requires(pipeline != null);
            Contract.Requires(name != null);

            this.Channel = pipeline.Channel();
            this.invoker = invoker;
            this.skipPropagationFlags = skipPropagationDirections;
            this.Name = name;
        }
Esempio n. 5
0
            public override Property Check(IChannelPipeline obj0, PipelineMutationModel obj1)
            {
                var pipeline        = obj0.AddLast(Name, Handler);
                var embeddedChannel = obj0.Channel() as EmbeddedChannel;

                Contract.Assert(embeddedChannel != null);
                embeddedChannel.RunPendingTasks();                // force the pipeline to run all scheduled tasks
                var pFirst  = pipeline.Reverse().Skip(1).First(); //bypass the head node
                var mFirst  = obj1.Tail.Previous.Handler;
                var pLength = pipeline.Count();
                var prop    = (pFirst == mFirst)
                              .Label($"Expected tail of pipeline to be {mFirst}, was {pFirst}")
                              .And(() => pLength == obj1.Length)
                              .Label($"Expected length of pipeline to be {obj1.Length}, was {pLength}");

                return(CheckEventInQueue(mFirst, SupportedEvent.HandlerAdded, prop, LastEventHistory(obj0)));
            }