Ejemplo n.º 1
0
        public void Should_map_properties_with_different_names()
        {
            var mappingOptions = new StubMappingOptions();
            mappingOptions.ReplaceMemberName("Ä", "A");
            mappingOptions.ReplaceMemberName("í", "i");
            mappingOptions.ReplaceMemberName("Airlina", "Airline");

            var typeMap = _factory.CreateTypeMap(typeof(Source), typeof(Destination), mappingOptions, MemberList.Destination);

            var propertyMaps = typeMap.GetPropertyMaps();

            propertyMaps.Count().ShouldEqual(3);
        }
Ejemplo n.º 2
0
        protected override void Establish_context()
        {
            var namingConvention = new StubNamingConvention();

            namingConvention.SplittingExpression = new Regex(@"[\p{Ll}0-9]*(?=_?)");

            _mappingOptions = new StubMappingOptions();
            _mappingOptions.SourceMemberNamingConvention = new PascalCaseNamingConvention();
            _mappingOptions.DestinationMemberNamingConvention = namingConvention;

            _factory = new TypeMapFactory();
        }
Ejemplo n.º 3
0
        protected override void Establish_context()
        {
            var namingConvention = new StubNamingConvention();
            namingConvention.SeparatorCharacter = "__";

            _mappingOptions = new StubMappingOptions();
            _mappingOptions.SourceMemberNamingConvention = namingConvention;
            _mappingOptions.DestinationMemberNamingConvention = new PascalCaseNamingConvention();

            _factory = new TypeMapFactory();
        }
Ejemplo n.º 4
0
        public void Should_map_properties_with_same_name()
        {
            var mappingOptions = new StubMappingOptions();
            mappingOptions.SourceMemberNamingConvention = new PascalCaseNamingConvention();
            mappingOptions.DestinationMemberNamingConvention = new PascalCaseNamingConvention();

            var typeMap = _factory.CreateTypeMap(typeof(Source), typeof(Destination), mappingOptions, MemberList.Destination);

            var propertyMaps = typeMap.GetPropertyMaps();

            propertyMaps.Count().ShouldEqual(2);
        }