diff --git a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs index 155cccf91c..f3c186b63d 100644 --- a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs +++ b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs @@ -95,8 +95,8 @@ public static void MapExistingList(List src, List dst) [MapDerivedType] [MapDerivedType] #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); diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs index 3d77b56c3a..fcbbf9df91 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/StaticMapperTest.SnapshotGeneratedSource_NET6_0.verified.cs @@ -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