private TypeReference GetDefaultType(PropertyInfo property) { var type = new TypeReference(property.PropertyType); if (property.PropertyType.IsEnum()) type = new TypeReference(typeof(GenericEnumMapper<>).MakeGenericType(property.PropertyType)); if (property.PropertyType.IsNullable() && property.PropertyType.IsEnum()) type = new TypeReference(typeof(GenericEnumMapper<>).MakeGenericType(property.PropertyType.GetGenericArguments()[0])); return type; }
public static XmlElement WithAtt(this XmlElement element, string key, TypeReference value) { return WithAtt(element, key, value.ToString()); }
public void IntTypeReferenceShouldNotEqualEmpty() { var intTypeReference = new TypeReference(typeof(int)); intTypeReference.Equals(TypeReference.Empty).ShouldBeFalse(); }
public void EmptyShouldNotEqualIntTypeReference() { var intTypeReference = new TypeReference(typeof(int)); TypeReference.Empty.Equals(intTypeReference).ShouldBeFalse(); }
public bool Equals(TypeReference other) { if (other.innerType == null && innerType == null) return other.innerName.Equals(innerName); return other.innerType.Equals(innerType); }
public void IsEnumOnTypeReferenceToGenericEnumMapperShouldBeTrue() { var enumTypeReference = new TypeReference(typeof(GenericEnumMapper<TestEnum>)); enumTypeReference.IsEnum.ShouldBeTrue(); }
public bool Equals(TypeReference other) { if(ReferenceEquals(other, null)) return false; if (other.innerType == null && innerType == null) return other.innerName.Equals(innerName); if (other.innerType != null) return other.innerType.Equals(innerType); return false; }