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); }
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); }
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); }
protected virtual Channel <TInput> Visitor <TInput, TOutput>(ConvertChannel <TInput, TOutput> channel) { Visit(channel.Output); return(channel); }
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)); }