Skip to content

Commit

Permalink
feat: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyMakkison committed Jul 16, 2023
1 parent 89ceb22 commit e3d4265
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> { "1", "2", "3", },
#if NET5_0_OR_GREATER
IReadOnlySet = new HashSet<string> { "1", "2", "3", },
Expand Down
6 changes: 4 additions & 2 deletions test/Riok.Mapperly.IntegrationTests/Dto/TestObjectDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ public TestObjectDto(int ctorValue, int unknownValue = 10, int ctorValue2 = 100)

public ISet<int> ExistingISet { get; } = new HashSet<int>();

public HashSet<int> ExistingHashSet { get; } = new HashSet<int>();
public HashSet<int> ExistingHashSet { get; } = new();

public SortedSet<int> ExistingSortedSet { get; } = new SortedSet<int>();
public SortedSet<int> ExistingSortedSet { get; } = new();

public List<int> ExistingList { get; } = new();

public ISet<int> ISet { get; set; } = new HashSet<int>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ public static TestObjectDto MapToDto(TestObject src)
return target;
}

public static void MapExistingList(List<string> src, List<int> 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))]
Expand Down
6 changes: 4 additions & 2 deletions test/Riok.Mapperly.IntegrationTests/Models/TestObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public TestObject(int ctorValue, int unknownValue = 10, int ctorValue2 = 100)

public ISet<string> ExistingISet { get; } = new HashSet<string>();

public HashSet<string> ExistingHashSet { get; } = new HashSet<string>();
public HashSet<string> ExistingHashSet { get; } = new();

public SortedSet<string> ExistingSortedSet { get; } = new SortedSet<string>();
public SortedSet<string> ExistingSortedSet { get; } = new();

public List<string> ExistingList { get; } = new();

public ISet<string> ISet { get; set; } = new HashSet<string>();

Expand Down

0 comments on commit e3d4265

Please sign in to comment.