public void Field_name_match_is_used_in_preference_to_property_setter() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.BreatheProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom<FieldInfo>(mapping.Item2); Assert.Equal("_breathe", mapping.Item2.Name); }
public void Property_setter_is_used_if_no_matching_field_is_found() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.OnTheRunProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom<PropertyInfo>(mapping.Item2); Assert.Equal("OnTheRun", mapping.Item2.Name); }
public void Property_and_field_in_base_type_is_matched() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(OfTheMoon.TheGreatGigInTheSkyProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom <FieldInfo>(mapping.Item2); Assert.Equal("_theGreatGigInTheSky", mapping.Item2.Name); }
public void Annotated_field_name_is_used_if_present() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.SpeakToMeProperty); property["BackingField"] = "fieldForSpeak"; var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.Equal("fieldForSpeak", mapping.Item2.Name); }
public void Property_setter_is_used_if_no_matching_field_is_found() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.OnTheRunProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom <PropertyInfo>(mapping.Item2); Assert.Equal("OnTheRun", mapping.Item2.Name); }
public void Field_name_match_is_used_in_preference_to_property_setter() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.BreatheProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom <FieldInfo>(mapping.Item2); Assert.Equal("_breathe", mapping.Item2.Name); }
public void Private_setter_in_base_class_of_overridden_property_is_used() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.UsAndThemProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom <PropertyInfo>(mapping.Item2); Assert.Equal("UsAndThem", mapping.Item2.Name); }
public void Property_and_field_in_base_type_is_matched_even_when_overridden() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.MoneyProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom <FieldInfo>(mapping.Item2); Assert.Equal("_money", mapping.Item2.Name); }
public void Annotated_field_name_is_used_if_present() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.SpeakToMeProperty); property["BackingField"] = "fieldForSpeak"; var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.Equal("fieldForSpeak", mapping.Item2.Name); }
public void Property_and_field_in_base_type_is_matched() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(OfTheMoon.TheGreatGigInTheSkyProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom<FieldInfo>(mapping.Item2); Assert.Equal("_theGreatGigInTheSky", mapping.Item2.Name); }
public void Private_setter_in_base_class_of_overridden_property_is_used() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.UsAndThemProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom<PropertyInfo>(mapping.Item2); Assert.Equal("UsAndThem", mapping.Item2.Name); }
public void Property_and_field_in_base_type_is_matched_even_when_overridden() { var entityType = new Model().AddEntityType(typeof(TheDarkSide)); var property = entityType.AddProperty(TheDarkSide.MoneyProperty); var mapping = new MemberMapper(new FieldMatcher()).MapPropertiesToMembers(entityType).Single(); Assert.Same(property, mapping.Item1); Assert.IsAssignableFrom<FieldInfo>(mapping.Item2); Assert.Equal("_money", mapping.Item2.Name); }