示例#1
0
        public void Should_capture_the_transform_channel_types()
        {
            var channel   = new ConsumerChannel <string>(new SynchronousFiber(), x => { });
            var transform = new ConvertChannel <int, string>(channel, x => x.ToString());

            new ChannelVisitor().Visit(transform);
        }
示例#2
0
		public void Should_capture_the_transform_channel_types()
		{
			var channel = new ConsumerChannel<string>(new SynchronousFiber(), x => { });
			var transform = new ConvertChannel<int, string>(channel, x => x.ToString());

			new ChannelVisitor().Visit(transform);
		}
示例#3
0
        protected override Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel)
        {
            _current = GetVertex(channel.GetHashCode(), () => "Convert", typeof(ConvertChannel <TInput, TOutput>), typeof(TInput));

            if (_stack.Count > 0)
            {
                _edges.Add(new Edge(_stack.Peek(), _current, _current.TargetType.Name));
            }

            return(WithVertex(() => base.Visitor(channel)));
        }
        protected override Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel)
        {
            if (_channels.Contains(channel.Output))
            {
                _channels.Remove(channel.Output);
                return(null);
            }

            Channel <TOutput> output = Visit(channel.Output);

            if (output == null)
            {
                return(null);
            }

            if (output != channel.Output)
            {
                return(new ConvertChannel <TInput, TOutput>(output, channel.Converter));
            }

            return(channel);
        }
示例#5
0
        protected virtual Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel)
        {
            Visit(channel.Output);

            return(channel);
        }
示例#6
0
        protected override Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel)
        {
            Trace.WriteLine("ConvertChannel<{0}>, Output: {1}".FormatWith(typeof(TInput).Name, typeof(TOutput).Name));

            return(base.Visitor(channel));
        }