public static CustomMethodInfo Create( CustomType declaringType = null, string name = "CustomMethod", MethodAttributes attributes = (MethodAttributes)7, ParameterInfo returnParameter = null, IEnumerable <ParameterInfo> parameters = null, MethodInfo baseDefinition = null, IEnumerable <ICustomAttributeData> customAttributes = null, MethodInfo genericMethodDefintion = null, IEnumerable <Type> typeArguments = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); returnParameter = returnParameter ?? CustomParameterInfoObjectMother.Create(position: -1, type: typeof(void)); parameters = parameters ?? new ParameterInfo[0]; // Base definition stays null. customAttributes = customAttributes ?? new ICustomAttributeData[0]; // Generic method definition stays null. var typeArgs = (typeArguments ?? Type.EmptyTypes).ToList(); return(new TestableCustomMethodInfo(declaringType, name, attributes, genericMethodDefintion, typeArgs) { ReturnParameter_ = returnParameter, Parameters = parameters.ToArray(), BaseDefinition = baseDefinition, CustomAttributeDatas = customAttributes.ToArray() }); }
public static CustomPropertyInfo Create( CustomType declaringType = null, string name = "UnspecifiedProperty", PropertyAttributes attributes = (PropertyAttributes)7, IEnumerable <ICustomAttributeData> customAttributes = null, CustomMethodInfo getMethod = null, CustomMethodInfo setMethod = null, ParameterInfo[] indexParameters = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); customAttributes = customAttributes ?? new ICustomAttributeData[0]; // Getter stays null. // Setters stays null, but if both are null then create a getter. if (getMethod == null && setMethod == null) { getMethod = CustomMethodInfoObjectMother.Create(returnParameter: CustomParameterInfoObjectMother.Create(position: -1, type: typeof(int))); } indexParameters = indexParameters ?? new ParameterInfo[0]; return(new TestableCustomPropertyInfo(declaringType, name, attributes, getMethod, setMethod) { CustomAttributeDatas = customAttributes, IndexParameters = indexParameters }); }
public static ConstructorOnCustomType Create( CustomType declaringType = null, MethodAttributes attributes = MethodAttributes.Public, IEnumerable <Type> typeArguments = null, IEnumerable <ParameterDeclaration> parameters = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); parameters = parameters ?? ParameterDeclaration.None; return(new ConstructorOnCustomType(declaringType, attributes, parameters)); }
public static MethodOnCustomType Create( CustomType declaringType = null, string name = "UnspecifiedMethod", MethodAttributes attributes = MethodAttributes.Public, IEnumerable <Type> typeArguments = null, Type returnType = null, IEnumerable <ParameterDeclaration> parameters = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); typeArguments = typeArguments ?? Type.EmptyTypes; returnType = returnType ?? typeof(void); parameters = parameters ?? ParameterDeclaration.None; return(new MethodOnCustomType(declaringType, name, attributes, typeArguments, returnType, parameters)); }
public static CustomFieldInfo Create( CustomType declaringType = null, string name = "CustomField", Type type = null, FieldAttributes attributes = (FieldAttributes)7, IEnumerable <ICustomAttributeData> customAttributes = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); type = type ?? ReflectionObjectMother.GetSomeType(); customAttributes = customAttributes ?? new ICustomAttributeData[0]; return(new TestableCustomFieldInfo(declaringType, name, type, attributes) { CustomAttributeDatas = customAttributes }); }
public static CustomConstructorInfo Create( CustomType declaringType = null, MethodAttributes attributes = (MethodAttributes)7, IEnumerable <ParameterInfo> parameters = null, IEnumerable <ICustomAttributeData> customAttributes = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); attributes |= MethodAttributes.SpecialName | MethodAttributes.RTSpecialName; parameters = parameters ?? new ParameterInfo[0]; customAttributes = customAttributes ?? new ICustomAttributeData[0]; return(new TestableCustomConstructorInfo(declaringType, attributes) { CustomAttributeDatas = customAttributes, Parameters = parameters.ToArray() }); }
public static CustomEventInfo Create( CustomType declaringType = null, string name = "Event", EventAttributes attributes = (EventAttributes)7, MethodInfo addMethod = null, MethodInfo removeMethod = null, MethodInfo raiseMethod = null, IEnumerable <ICustomAttributeData> customAttributes = null) { declaringType = declaringType ?? CustomTypeObjectMother.Create(); addMethod = addMethod ?? NormalizingMemberInfoFromExpressionUtility.GetMethod((DomainType o) => o.AddMethod(null)); removeMethod = removeMethod ?? NormalizingMemberInfoFromExpressionUtility.GetMethod((DomainType o) => o.RemoveMethod(null)); // Raise method stays null. customAttributes = customAttributes ?? new ICustomAttributeData[0]; return(new TestableCustomEventInfo(declaringType, name, attributes, addMethod, removeMethod, raiseMethod) { CustomAttributeDatas = customAttributes }); }
public static ArrayTypeBase Create(CustomType elementType = null, int rank = 1) { elementType = elementType ?? CustomTypeObjectMother.Create(name: "UnspecifiedType"); return(new TestableArrayTypeBase(elementType, rank)); }
public static VectorType Create(CustomType elementType = null) { elementType = elementType ?? CustomTypeObjectMother.Create(name: "UnspecifiedType"); return(new VectorType(elementType)); }
public static MultiDimensionalArrayType Create(CustomType elementType = null, int rank = 2) { elementType = elementType ?? CustomTypeObjectMother.Create(name: "UnspecifiedType"); return(new MultiDimensionalArrayType(elementType, rank)); }