private static void LogicTest(Type[] types, object callTarget, Type type, string methodName)
        {
            ExecutionSequenceHandler <ExecutionData>[] delegates =
                DelegateHelper.CreateDelegates <ExecutionSequenceHandler <ExecutionData> >(
                    callTarget, type, methodName, types);

            Assert.AreEqual(types.Length, delegates.Length);
            for (int i = 0; i < types.Length; i++)
            {
                ExecutionSequenceHandler <ExecutionData> d =
                    DelegateHelper.CreateDelegate <ExecutionSequenceHandler <ExecutionData> >(
                        callTarget, type, methodName, types[i]);
                Assert.AreSame(d.Target, delegates[i].Target);
                Assert.AreSame(d.Method, delegates[i].Method);
            }

            ExecutionData data = ExecutionData.Create();

            DelegateHelper.ExecuteDelegates(delegates, ref data, Direction.Positive);
            Assert.IsTrue(AdvancedComparer <IEnumerable <Type> > .Default.Equals(types, data.CalledForTypes));

            data = ExecutionData.Create();
            DelegateHelper.ExecuteDelegates(delegates, ref data, Direction.Negative);
            Assert.IsTrue(AdvancedComparer <IEnumerable <Type> > .Default.Equals(types, Reverse(data.CalledForTypes)));
        }
        private void TestTypes(Type[] types)
        {
            TupleDescriptor descriptor = TupleDescriptor.Create(types);

            TestLog.Info("Testing sequence {0}:", descriptor);
            using (IndentManager.IncreaseIndent()) {
                // Logic test
                LogicTest(types, this, GetType(), "SequenceAStep");
                LogicTest(types, null, GetType(), "SequenceAStaticStep");

                // Performance tests
                ExecutionData data = ExecutionData.Create();
                ExecutionSequenceHandler <ExecutionData>[] delegates;

                int count = passCount / 1000;
                delegates = DelegateHelper.CreateDelegates <ExecutionSequenceHandler <ExecutionData> >(
                    this, GetType(), "SequenceBStep", types);
                TestHelper.CollectGarbage();
                using (new Measurement("Creating delegates", count))
                    for (int i = 0; i < count; i++)
                    {
                        delegates = DelegateHelper.CreateDelegates <ExecutionSequenceHandler <ExecutionData> >(
                            this, GetType(), "SequenceBStep", types);
                    }

                count = passCount;
                DelegateHelper.ExecuteDelegates(delegates, ref data, Direction.Positive);
                data = ExecutionData.Create();
                TestHelper.CollectGarbage();
                using (new Measurement("Executing delegates", count))
                    for (int i = 0; i < count; i++)
                    {
                        DelegateHelper.ExecuteDelegates(delegates, ref data, Direction.Positive);
                    }
                Assert.AreEqual(count * types.Length, data.CallCount);
            }
        }