Skip to content

Commit

Permalink
chore: update integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyMakkison committed Nov 25, 2023
1 parent 7b85469 commit 02418ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public static void MapExistingList(List<string> src, List<int> dst)
[MapDerivedType<ExistingObjectTypeA, ExistingObjectTypeA>]
[MapDerivedType<ExistingObjectTypeB, ExistingObjectTypeB>]
#else
[MapDerivedType(typeof(ExistingObjectTypeA), typeof(ExistingObjectTypeADto))]
[MapDerivedType(typeof(ExistingObjectTypeB), typeof(ExistingObjectTypeBDto))]
[MapDerivedType(typeof(ExistingObjectTypeA), typeof(ExistingObjectTypeA))]
[MapDerivedType(typeof(ExistingObjectTypeB), typeof(ExistingObjectTypeB))]
#endif
public static partial void MapToDerivedExisting(ExistingObjectBase source, ExistingObjectBase target);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,23 @@ object x when typeof(TTarget).IsAssignableFrom(typeof(object)) => (TTarget)(obje
};
}

public static partial void MapToDerivedExisting(global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectBase source, global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectBase target)
{
switch (source, target)
{
case (global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectTypeA source1, global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectTypeA target1):
target1.ValueA = DirectInt(source1.ValueA);
target1.Value = DirectInt(source1.Value);
break;
case (global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectTypeB source1, global::Riok.Mapperly.IntegrationTests.Models.ExistingObjectTypeB target1):
target1.ValueB = DirectInt(source1.ValueB);
target1.Value = DirectInt(source1.Value);
break;
default:
throw new System.ArgumentException($"Cannot map {source.GetType()} to {target.GetType()} as there is no known derived type mapping", nameof(source));
}
}

public static partial global::Riok.Mapperly.IntegrationTests.Dto.TestEnumDtoByName MapToEnumDtoByName(global::Riok.Mapperly.IntegrationTests.Models.TestEnum v)
{
return v switch
Expand Down

0 comments on commit 02418ec

Please sign in to comment.