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); } }
private bool SequenceBStep <T>(ref ExecutionData data, int index) { data.CallCount++; return(false); }
bool Execute <TFieldType>(ref ExecutionData actionData, int fieldIndex) { actionData.CallCount++; return(false); }
private static bool SequenceAStaticStep <T>(ref ExecutionData data, int index) { data.CalledForTypes.Add(typeof(T)); return(false); }