diff --git a/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs b/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs index 0eaa946613..8e547c30f3 100644 --- a/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs +++ b/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs @@ -109,6 +109,7 @@ public static TestObject NewTestObj() ExistingISet = { "1", "2", "3", }, ExistingHashSet = { "1", "2", "3", }, ExistingSortedSet = { "1", "2", "3", }, + ExistingList = { "1", "2", "3", }, ISet = new HashSet { "1", "2", "3", }, #if NET5_0_OR_GREATER IReadOnlySet = new HashSet { "1", "2", "3", }, diff --git a/test/Riok.Mapperly.IntegrationTests/Dto/TestObjectDto.cs b/test/Riok.Mapperly.IntegrationTests/Dto/TestObjectDto.cs index 2e0c554ea2..ea814ea60f 100644 --- a/test/Riok.Mapperly.IntegrationTests/Dto/TestObjectDto.cs +++ b/test/Riok.Mapperly.IntegrationTests/Dto/TestObjectDto.cs @@ -79,9 +79,11 @@ public TestObjectDto(int ctorValue, int unknownValue = 10, int ctorValue2 = 100) public ISet ExistingISet { get; } = new HashSet(); - public HashSet ExistingHashSet { get; } = new HashSet(); + public HashSet ExistingHashSet { get; } = new(); - public SortedSet ExistingSortedSet { get; } = new SortedSet(); + public SortedSet ExistingSortedSet { get; } = new(); + + public List ExistingList { get; } = new(); public ISet ISet { get; set; } = new HashSet(); diff --git a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs index 84c41bbf12..ffe5161dd3 100644 --- a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs +++ b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs @@ -38,6 +38,15 @@ public static TestObjectDto MapToDto(TestObject src) return target; } + public static void MapExistingList(List src, List dst) + { + dst.EnsureCapacity(src.Count + dst.Count); + foreach (var item in src) + { + dst.Add(int.Parse(item)); + } + } + // disable obsolete warning, as the obsolete attribute should still be tested. #pragma warning disable CS0618 [MapperIgnore(nameof(TestObjectDto.IgnoredStringValue))] diff --git a/test/Riok.Mapperly.IntegrationTests/Models/TestObject.cs b/test/Riok.Mapperly.IntegrationTests/Models/TestObject.cs index c01df23838..86605edc40 100644 --- a/test/Riok.Mapperly.IntegrationTests/Models/TestObject.cs +++ b/test/Riok.Mapperly.IntegrationTests/Models/TestObject.cs @@ -77,9 +77,11 @@ public TestObject(int ctorValue, int unknownValue = 10, int ctorValue2 = 100) public ISet ExistingISet { get; } = new HashSet(); - public HashSet ExistingHashSet { get; } = new HashSet(); + public HashSet ExistingHashSet { get; } = new(); - public SortedSet ExistingSortedSet { get; } = new SortedSet(); + public SortedSet ExistingSortedSet { get; } = new(); + + public List ExistingList { get; } = new(); public ISet ISet { get; set; } = new HashSet();