Skip to content

Commit eec2dcc

Browse files
authored
Mapping plan extras (#30)
* Support for accessing mapping plans for anonymous sources and user-defined struct mappings * Adding Mapper.GetPlansFor() to generate and cache mapping plans for a type pair for all rule sets in one call * Test coverage for unmappable members appearing in test plans * Returning MappingPlan objects from GetPlanFor().To() methods to avoid the overhead of creating the plan string if all the caller wants to do is cache * Adding Mapper.GetPlansInCache() to expose all currently-cached mapping plans * Adding a GetPlansFor overload for anonymous source types
1 parent 9c5de93 commit eec2dcc

26 files changed

+593
-157
lines changed

AgileMapper.UnitTests/Configuration/WhenConfiguringEnumMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void ShouldRemovePairedEnumsFromEnumMismatchWarnings()
3636
mapper.WhenMapping
3737
.PairEnum(PaymentTypeUk.Cheque).With(PaymentTypeUs.Check);
3838

39-
var plan = mapper
39+
string plan = mapper
4040
.GetPlanFor<PublicTwoFields<PaymentTypeUk, PaymentTypeUs>>()
4141
.OnTo<PublicTwoFields<PaymentTypeUs, PaymentTypeUk>>();
4242

AgileMapper.UnitTests/Dictionaries/WhenViewingDictionaryMappingPlans.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class WhenViewingDictionaryMappingPlans
1111
[Fact]
1212
public void ShouldShowATargetObjectMappingPlan()
1313
{
14-
var plan = Mapper
14+
string plan = Mapper
1515
.GetPlanFor<Dictionary<string, string>>()
1616
.ToANew<CustomerViewModel>();
1717

@@ -25,7 +25,7 @@ public void ShouldShowATargetObjectMappingPlan()
2525
[Fact]
2626
public void ShouldShowATargetComplexTypeCollectionMappingPlan()
2727
{
28-
var plan = Mapper
28+
string plan = Mapper
2929
.GetPlanFor<Dictionary<string, object>>()
3030
.ToANew<Collection<Address>>();
3131

@@ -39,7 +39,7 @@ public void ShouldShowATargetComplexTypeCollectionMappingPlan()
3939
[Fact]
4040
public void ShouldShowASourceObjectMappingPlan()
4141
{
42-
var plan = Mapper
42+
string plan = Mapper
4343
.GetPlanFor<MysteryCustomer>()
4444
.ToANew<Dictionary<string, object>>();
4545

@@ -51,7 +51,7 @@ public void ShouldShowASourceObjectMappingPlan()
5151
[Fact]
5252
public void ShouldShowASourceComplexTypeEnumerableMappingPlan()
5353
{
54-
var plan = Mapper
54+
string plan = Mapper
5555
.GetPlanFor<IEnumerable<CustomerViewModel>>()
5656
.ToANew<Dictionary<string, string>>();
5757

AgileMapper.UnitTests/WhenMappingCircularReferences.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public void ShouldMapNestedMultiplyRecursiveRelationships()
307307
[Fact]
308308
public void ShouldGenerateAMappingPlanForLinkRelationships()
309309
{
310-
var plan = Mapper.GetPlanFor<Video>().Over<Video>();
310+
string plan = Mapper.GetPlanFor<Video>().Over<Video>();
311311

312312
plan.ShouldNotBeNull();
313313
plan.ShouldContain("WhenMappingCircularReferences.Video -> WhenMappingCircularReferences.Video");
@@ -317,7 +317,7 @@ public void ShouldGenerateAMappingPlanForLinkRelationships()
317317
[Fact]
318318
public void ShouldGenerateAMappingPlanForAOneToOneRelationship()
319319
{
320-
var plan = Mapper
320+
string plan = Mapper
321321
.GetPlanFor<Parent>()
322322
.ToANew<Parent>();
323323

0 commit comments

Comments
 (0)