File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ public string[] Split(string input)
2424 int lower = 0 ;
2525 for ( int index = 1 ; index < input . Length ; index ++ )
2626 {
27- if ( char . IsUpper ( input [ index ] ) )
27+ if ( char . IsUpper ( input [ index ] ) &&
28+ ( ! char . IsUpper ( input [ index - 1 ] ) ||
29+ ( index + 1 < input . Length && ! char . IsUpper ( input [ index + 1 ] ) ) ) )
2830 {
2931 result ??= [ ] ;
3032 result . Add ( input [ lower ..index ] ) ;
Original file line number Diff line number Diff line change @@ -104,6 +104,22 @@ public void Should_map_from_pascal_to_lower()
104104 _dario . JaSeZovemImenom . ShouldBe ( "foo" ) ;
105105 }
106106}
107+ public class PascalCaseAcronymInPropertyName : AutoMapperSpecBase
108+ {
109+ class Source { public Inner Form { get ; set ; } }
110+ class Inner { public int XML { get ; set ; } }
111+ class Dest { public int FormXML { get ; set ; } }
112+
113+ protected override MapperConfiguration CreateConfiguration ( ) => new ( cfg =>
114+ cfg . CreateMap < Source , Dest > ( ) ) ;
115+
116+ [ Fact ]
117+ public void Should_flatten_acronym_property ( )
118+ {
119+ var result = Mapper . Map < Dest > ( new Source { Form = new Inner { XML = 42 } } ) ;
120+ result . FormXML . ShouldBe ( 42 ) ;
121+ }
122+ }
107123
108124public class When_mapping_with_lowercase_naming_conventions_two_ways : AutoMapperSpecBase
109125{
You can’t perform that action at this time.
0 commit comments