public void Pipeline_BindArgumentToPipelineOutput_By_Name()
        {
            MockProcessor1 processor = new MockProcessor1();
            MockPipeline   pipeline  = new MockPipeline(
                new Processor[] { processor },
                Enumerable.Empty <ProcessorArgument>(),
                new ProcessorArgument[] { new ProcessorArgument("PipelineOutput", typeof(string)) });

            BindArgumentsEventArgs eventArgs      = null;
            ProcessorArgument      inArgFromBind  = null;
            ProcessorArgument      outArgFromBind = null;

            pipeline.OnBindArgumentsCalled = (outArg, inArg) =>
            {
                inArgFromBind  = inArg;
                outArgFromBind = outArg;
            };

            pipeline.BoundArguments = (s, a) => { eventArgs = a as BindArgumentsEventArgs; };
            pipeline.BindArgumentToPipelineOutput(processor.OutArguments[0], "PipelineOutput");
            Assert.IsNotNull(eventArgs, "Did not receive OnBoundArguments callback");
            Assert.AreSame(pipeline.Processors[1].OutArguments[0], outArgFromBind, "Did not receive correct outArg in OnBind virtual");
            Assert.AreSame(pipeline.Processors[2].InArguments[0], inArgFromBind, "Did not receive correct inArg in OnBind virtual");
            Assert.IsTrue(pipeline.GetBoundToArguments(pipeline.Processors[1].OutArguments[0]).Contains(pipeline.Processors[2].InArguments[0]),
                          "Failed to find exit processor in argument in bindings for processor 1");
        }
        public void Pipeline_Bind_OnBinding_OnBind_OnBound_Callbacks()
        {
            MockProcessor1          processor1 = new MockProcessor1();
            MockProcessorEchoString processor2 = new MockProcessorEchoString();
            MockPipeline            pipeline   = new MockPipeline(
                new Processor[] { processor1, processor2 },
                Enumerable.Empty <ProcessorArgument>(),
                Enumerable.Empty <ProcessorArgument>());
            BindArgumentsEventArgs bindingEventArgs = null;
            BindArgumentsEventArgs boundEventArgs   = null;
            ProcessorArgument      inArgFromBind    = null;
            ProcessorArgument      outArgFromBind   = null;

            pipeline.OnBindArgumentsCalled = (outArg, inArg) =>
            {
                inArgFromBind  = inArg;
                outArgFromBind = outArg;
            };

            pipeline.BindingArguments = (s, a) => { bindingEventArgs = a as BindArgumentsEventArgs; };
            pipeline.BoundArguments   = (s, a) => { boundEventArgs = a as BindArgumentsEventArgs; };

            pipeline.BindArguments(processor1.OutArguments[0], processor2.InArguments[0]);
            Assert.IsNotNull(bindingEventArgs, "Did not receive BindingArguments callback");
            Assert.AreSame(processor1.OutArguments[0], bindingEventArgs.OutArgument, "Did not receive correct outArg in BindingArgument callback");
            Assert.AreSame(processor2.InArguments[0], bindingEventArgs.InArgument, "Did not receive correct inArg in BindingArgument callback");

            Assert.IsNotNull(boundEventArgs, "Did not receive BoundArguments callback");
            Assert.AreSame(processor1.OutArguments[0], boundEventArgs.OutArgument, "Did not receive correct outArg in BoundArgument callback");
            Assert.AreSame(processor2.InArguments[0], boundEventArgs.InArgument, "Did not receive correct inArg in BoundArgument callback");

            Assert.AreSame(processor1.OutArguments[0], outArgFromBind, "Did not receive correct outArg in OnBind virtual");
            Assert.AreSame(processor2.InArguments[0], inArgFromBind, "Did not receive correct inArg in OnBind virtual");
        }