public void ReflectionExtension_can_determine_if_prop_has_ignore_data_member() { var dto = new ClassWithDataMembers(); var propWithIgnore = dto.GetType().GetProperties().Single(p => p.Name == "IgnoreMePlease"); var hasAttr = propWithIgnore.HasIgnoreDataMemberAttribute(); Assert.True(hasAttr); var propNoIgnore = dto.GetType().GetProperties().Single(p => p.Name == "MemberWithCustomName"); Assert.False(propNoIgnore.HasIgnoreDataMemberAttribute()); }
public void ReflectionExtension_resolves_prop_names_correctly() { var dto = new ClassWithDataMembers(); var dtoProps = dto.GetType().GetProperties(); var propNoCustomName = dtoProps.Single(p => p.Name == "MemberNoCustomName"); Assert.Equal("MemberNoCustomName", propNoCustomName.GetPropSerializedName()); var propWithCustomName = dtoProps.Single(p => p.Name == "MemberWithCustomName"); Assert.Equal("CallMeThis", propWithCustomName.GetPropSerializedName()); }