public static MutablePropertyInfo CreateReadWrite( MutableType declaringType = null, string name = "UnspecifiedProperty", PropertyAttributes attributes = PropertyAttributes.None, Type type = null) { declaringType = declaringType ?? MutableTypeObjectMother.Create(); type = type ?? ReflectionObjectMother.GetSomeType(); var getMethod = MutableMethodInfoObjectMother.Create(returnType: type); var setMethod = MutableMethodInfoObjectMother.Create(parameters: new[] { ParameterDeclarationObjectMother.Create(type) }); return(new MutablePropertyInfo(declaringType, name, attributes, getMethod, setMethod)); }
public static MutablePropertyInfo Create( MutableType declaringType = null, string name = "UnspecifiedProperty", PropertyAttributes attributes = PropertyAttributes.None, MutableMethodInfo getMethod = null, MutableMethodInfo setMethod = null) { declaringType = declaringType ?? MutableTypeObjectMother.Create(); if (getMethod == null && setMethod == null) { getMethod = MutableMethodInfoObjectMother.Create(declaringType, "Getter", returnType: typeof(int)); } return(new MutablePropertyInfo(declaringType, name, attributes, getMethod, setMethod)); }
private static MutableMethodInfo CreateMethod(MutableType declaringType, string name, Type[] parameterTypes, Type returnType = null) { var parameters = parameterTypes.Select((t, i) => ParameterDeclarationObjectMother.Create(t, i.ToString(CultureInfo.InvariantCulture))); return(MutableMethodInfoObjectMother.Create(declaringType, name, returnType: returnType, parameters: parameters)); }