-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73b0e8d
commit 9e5ca4f
Showing
7 changed files
with
140 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...TargetTypeTest.WithAbstractBaseClassAndNonGenericInterfaceShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A src, global::B trg) | ||
{ | ||
switch (src, trg) | ||
{ | ||
case (global::ASubType1 source, global::BSubType1 target): | ||
target.Value1 = source.Value1; | ||
target.BaseValue = source.BaseValue; | ||
break; | ||
case (global::ASubType2 source, global::BSubType2 target): | ||
target.Value2 = source.Value2; | ||
target.BaseValue = source.BaseValue; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...pshots/DerivedExistingTargetTypeTest.WithAbstractBaseClassShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A src, global::B trg) | ||
{ | ||
switch (src, trg) | ||
{ | ||
case (global::ASubType1 source, global::BSubType1 target): | ||
target.Value1 = source.Value1; | ||
target.BaseValue = source.BaseValue; | ||
break; | ||
case (global::ASubType2 source, global::BSubType2 target): | ||
target.Value1 = source.Value1; | ||
target.BaseValue = source.BaseValue; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...snapshots/DerivedExistingTargetTypeTest.WithBaseTypeConfigShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A src, global::B trg) | ||
{ | ||
switch (src, trg) | ||
{ | ||
case (global::ASubType1 source, global::BSubType1 target): | ||
target.Value1 = source.Value1; | ||
target.BaseValueB = source.BaseValueA; | ||
break; | ||
case (global::ASubType2 source, global::BSubType2 target): | ||
target.Value2 = source.Value2; | ||
target.BaseValueB = source.BaseValueA; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...sts/_snapshots/DerivedExistingTargetTypeTest.WithInterfaceShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A src, global::B trg) | ||
{ | ||
switch (src, trg) | ||
{ | ||
case (global::AImpl1 source, global::BImpl1 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value1 = source.Value1; | ||
break; | ||
case (global::AImpl2 source, global::BImpl2 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value2 = source.Value2; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...xistingTargetTypeTest.WithInterfaceSourceAndTargetNullableShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A? src, global::B? trg) | ||
{ | ||
if (src == null || trg == null) | ||
return; | ||
switch (src, trg) | ||
{ | ||
case (global::AImpl1 source, global::BImpl1 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value1 = source.Value1; | ||
break; | ||
case (global::AImpl2 source, global::BImpl2 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value2 = source.Value2; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../DerivedExistingTargetTypeTest.WithInterfaceSourceNullableShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
public partial void Map(global::A? src, global::B trg) | ||
{ | ||
if (src == null) | ||
return; | ||
switch (src, trg) | ||
{ | ||
case (global::AImpl1 source, global::BImpl1 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value1 = source.Value1; | ||
break; | ||
case (global::AImpl2 source, global::BImpl2 target): | ||
target.BaseValue = source.BaseValue; | ||
target.Value2 = source.Value2; | ||
break; | ||
default: | ||
throw new System.ArgumentException($"Cannot map {src.GetType()} to {trg.GetType()} as there is no known derived type mapping", nameof(src)); | ||
} | ||
} | ||
} |