private static CapturingConstraint SetupConstraint <T>(MethodInfo method, IMethodOptions <T> options, Action <IMethodOptions <T> > optionsAction) { var constraint = new CapturingConstraint(); var constraints = new List <AbstractConstraint>(); foreach (ParameterInfo arg in method.GetParameters()) { constraints.Add(constraint); } options = options.Constraints(constraints.ToArray()).Repeat.Any(); if (optionsAction != null) { optionsAction(options); } return(constraint); }