/// <summary>Selects the methods for the supplied type.</summary> /// <param name="type">The type.</param> /// <returns>Methods for <paramref name="type"/>.</returns> public IEnumerable <IMethod> SelectMethods(Type type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (type.GetTypeInfo().IsInterface || DelegateSpecification.IsSatisfiedBy(type)) { return new[] { SubstituteMethod.Create(type) } } ; return(from ci in type.GetPublicAndProtectedConstructors() let parameters = ci.GetParameters() orderby parameters.Length ascending select SubstituteMethod.Create(type, parameters)); }
/// <summary>Selects the methods for the supplied type.</summary> /// <param name="type">The type.</param> /// <returns>Methods for <paramref name="type"/>.</returns> public IEnumerable <IMethod> SelectMethods(Type type) { if (type == null) { throw new ArgumentNullException("type"); } if (type.IsInterface) { return new[] { SubstituteMethod.Create(type) } } ; return(from ci in type.GetPublicAndProtectedConstructors() let parameters = ci.GetParameters() orderby parameters.Length ascending select SubstituteMethod.Create(type, parameters)); }
public static IMethod Create(Type type) { return(SubstituteMethod.Create(type, new ParameterInfo[0])); }