Beispiel #1
0
        static bool TryAddPropertyFromElement(ITypeMapping typeMapping, ICollection <XElement> elementList, PropertyInfo property, IPropertyStrategy propertyStrategy, string name)
        {
            var element = TakeElement(elementList, name);

            if (element == null)
            {
                return(false);
            }

            var mapper          = propertyStrategy.Mapper ?? MapperSelector.GetFor(property.PropertyType);
            var propertyMapping = new MappingFromElement(element, property, mapper);

            typeMapping.Include(propertyMapping);
            return(true);
        }
 public void Keyed_collection_types_can_be_mapped_by_the_KeyedCollectionMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <KeyedCollectionMapper>();
 }
 public void Types_which_cannot_be_mapped_by_any_other_mapper_should_attempt_to_use_the_RecursingMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <RecursingMapper>();
 }
 public void Dictionary_types_can_be_mapped_by_the_DictionaryMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <DictionaryMapper>();
 }
 public void Key_value_pairs_can_be_mapped_by_the_KeyValuePairMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <KeyValuePairMapper>();
 }
 public void Single_dimensional_array_types_can_be_mapped_by_the_ArrayMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <ArrayMapper>();
 }
 public void Generic_collection_types_which_are_implemented_by_List_can_be_mapped_by_the_CollectionMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <CollectionMapper>();
 }
 public void Simple_types_can_be_mapped_by_the_ValueMapper(Type type)
 {
     MapperSelector.GetFor(type).Should().BeOfType <ValueMapper>();
 }