public static Access Resolve(Member member) { if (member.IsAutoProperty) { var property = (PropertyMember)member; if (property.Set != null && !(property.Set.IsPrivate || property.Set.IsInternal)) { return(Access.Property); } return(Access.BackField); } if (member.IsProperty) { var property = (PropertyMember)member; if (property.Set != null && !(property.Set.IsPrivate || property.Set.IsInternal)) { return(Access.Property); } Member backingField; if (!property.TryGetBackingField(out backingField)) { return(Access.Property); // just use default, don't think we can do anything here } return(Access.ReadOnlyPropertyWithField(Naming.Determine(backingField.Name))); } if (member.IsMethod) { var method = (MethodMember)member; Member backingField; if (!method.TryGetBackingField(out backingField)) { return(Access.Property); // just use default, don't think we can do anything here } return(Access.Field); // use a field because we just access methods backing fields directly } if (member.IsField) { return(Access.Field); } return(Access.Property); // just default it if we can't guess, NH will complain but oh well }
public void Lowercase() { Naming.Determine("alllowercase") .ShouldEqual(NamingStrategy.LowerCase); }
public void PascalcaseM() { Naming.Determine("mPascalCase") .ShouldEqual(NamingStrategy.PascalCaseM); }
public void PascalcaseUnderscore() { Naming.Determine("_PascalCase") .ShouldEqual(NamingStrategy.PascalCaseUnderscore); }
public void CamelcaseMUnderscore() { Naming.Determine("m_camelCase") .ShouldEqual(NamingStrategy.Unknown); }
public void CamelcaseUnderscore() { Naming.Determine("_camelCase") .ShouldEqual(NamingStrategy.CamelCaseUnderscore); }
public void Camelcase() { Naming.Determine("camelCase") .ShouldEqual(NamingStrategy.CamelCase); }
public void LowercaseMUnderscore() { Naming.Determine("m_alllowercase") .ShouldEqual(NamingStrategy.Unknown); }
public void LowercaseUnderscore() { Naming.Determine("_alllowercase") .ShouldEqual(NamingStrategy.LowerCaseUnderscore); }