private void DoTo(ITopicNameExtractor <K, V> topicExtractor, Produced <K, V> produced)
        {
            string name = new Named(produced.Named).OrElseGenerateWithPrefix(this.builder, SINK_NAME);

            StreamSinkNode <K, V> sinkNode = new StreamSinkNode <K, V>(topicExtractor, name, produced);

            this.builder.AddGraphNode(node, sinkNode);
        }
        public void WriteTopologyTest()
        {
            var builder = new InternalTopologyBuilder();
            List <StreamGraphNode> nodes = new List <StreamGraphNode>();

            RootNode root   = new RootNode();
            var      source = new StreamSourceNode <string, string>(
                "topic",
                "source-01",
                new Stream.Internal.ConsumedInternal <string, string>("source-01", new StringSerDes(),
                                                                      new StringSerDes(), null));

            root.AppendChild(source);
            nodes.Add(source);

            var filterParameters =
                new ProcessorParameters <string, string>(
                    new KStreamFilter <string, string>((k, v) => true, false), "filter-02");
            var filter = new ProcessorGraphNode <string, string>("filter-02", filterParameters);

            source.AppendChild(filter);
            nodes.Add(filter);

            var to = new StreamSinkNode <string, string>(
                new StaticTopicNameExtractor <string, string>("topic2"), "to-03",
                new Stream.Internal.Produced <string, string>(
                    new StringSerDes(),
                    new StringSerDes())
                );

            filter.AppendChild(to);
            nodes.Add(to);

            builder.BuildTopology(root, nodes);

            Assert.IsTrue(root.AllParentsWrittenToTopology);
            Assert.IsTrue(source.AllParentsWrittenToTopology);
            Assert.IsTrue(filter.AllParentsWrittenToTopology);
            Assert.IsTrue(to.AllParentsWrittenToTopology);

            var topology = builder.BuildTopology();

            Assert.IsTrue(topology.SourceOperators.ContainsKey("topic"));
            Assert.IsTrue(topology.ProcessorOperators.ContainsKey("filter-02"));
            Assert.IsTrue(topology.SinkOperators.ContainsKey("topic2"));
        }