Skip to content

Commit fb2f400

Browse files
authored
Merge pull request #21 from BlaiseD/master
Release 1.0.5
2 parents b59b1c3 + 07f2231 commit fb2f400

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<Authors>Jimmy Bogard</Authors>
44
<LangVersion>latest</LangVersion>
5-
<VersionPrefix>1.0.5-preview02</VersionPrefix>
5+
<VersionPrefix>1.0.5</VersionPrefix>
66
<WarningsAsErrors>true</WarningsAsErrors>
77
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
88
</PropertyGroup>

tests/AutoMapper.Extensions.ExpressionMapping.UnitTests/XpressionMapperTests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,19 @@ void CallSomeAction<T>(T val)
635635
{
636636
this.val = val;
637637
}
638+
639+
[Fact]
640+
public void Can_map_expression_when_mapped_properties_have_a_different_generic_argument_counts()
641+
{
642+
//Arrange
643+
Expression<Func<ListParent, bool>> src = x => x.List.Count == 0;
644+
645+
//Act
646+
Expression<Func<ListParentExtension, bool>> dest = mapper.Map<Expression<Func<ListParentExtension, bool>>>(src);
647+
648+
//Assert
649+
Assert.NotNull(dest);
650+
}
638651
#endregion Tests
639652

640653
private static void SetupAutoMapper()
@@ -1018,6 +1031,20 @@ class ItemEntity
10181031
public string Name { get; set; }
10191032
}
10201033

1034+
class ListParentExtension
1035+
{
1036+
public ListExtension List { get; set; }
1037+
}
1038+
1039+
class ListParent : List<string>
1040+
{
1041+
public List<string> List { get; set; }
1042+
}
1043+
1044+
class ListExtension : List<string>
1045+
{
1046+
}
1047+
10211048
public class OrganizationProfile : Profile
10221049
{
10231050
public OrganizationProfile()
@@ -1112,6 +1139,13 @@ public OrganizationProfile()
11121139

11131140
CreateMap<OptionT, OptionS>();
11141141

1142+
CreateMap<ListParentExtension, ListParent>()
1143+
.ReverseMap();
1144+
CreateMap<ListExtension, List<string>>()
1145+
.ForMember(d => d.Count, opt => opt.MapFrom(s => s.Count))
1146+
.ReverseMap()
1147+
.ForMember(d => d.Count, opt => opt.MapFrom(s => s.Count));
1148+
11151149
CreateMissingTypeMaps = true;
11161150
}
11171151
}

0 commit comments

Comments
 (0)