Ejemplo n.º 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);
        }
Ejemplo n.º 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);
		}
Ejemplo n.º 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)));
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        protected virtual Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel)
        {
            Visit(channel.Output);

            return(channel);
        }
Ejemplo n.º 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));
        }