コード例 #1
0
        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);
            }
        }
コード例 #2
0
 private bool SequenceBStep <T>(ref ExecutionData data, int index)
 {
     data.CallCount++;
     return(false);
 }
コード例 #3
0
 bool Execute <TFieldType>(ref ExecutionData actionData, int fieldIndex)
 {
     actionData.CallCount++;
     return(false);
 }
コード例 #4
0
 private static bool SequenceAStaticStep <T>(ref ExecutionData data, int index)
 {
     data.CalledForTypes.Add(typeof(T));
     return(false);
 }