-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use all modifiers for user method mapping
- Loading branch information
Showing
54 changed files
with
336 additions
and
140 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
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
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,44 @@ | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using Riok.Mapperly.IntegrationTests.Mapper; | ||
using VerifyXunit; | ||
using Xunit; | ||
|
||
namespace Riok.Mapperly.IntegrationTests | ||
{ | ||
[UsesVerify] | ||
public class DerivedMapperTest : BaseMapperTest | ||
{ | ||
[Fact] | ||
public Task SnapshotGeneratedSourceBaseMapper() | ||
{ | ||
var path = GetGeneratedMapperFilePath(nameof(BaseMapper)); | ||
return Verifier.VerifyFile(path); | ||
} | ||
|
||
[Fact] | ||
public Task SnapshotGeneratedSourceDerivedMapper() | ||
{ | ||
var path = GetGeneratedMapperFilePath(nameof(DerivedMapper)); | ||
return Verifier.VerifyFile(path); | ||
} | ||
|
||
[Fact] | ||
public Task SnapshotGeneratedSourceDerivedMapper2() | ||
{ | ||
var path = GetGeneratedMapperFilePath(nameof(DerivedMapper2)); | ||
return Verifier.VerifyFile(path); | ||
} | ||
|
||
[Fact] | ||
public void RunMappingShouldWork() | ||
{ | ||
new BaseMapper().IntToLong(10).Should().Be(10L); | ||
new BaseMapper().IntToShort(10).Should().Be(10); | ||
new DerivedMapper().IntToLong(10).Should().Be(10L); | ||
new DerivedMapper().IntToShort(10).Should().Be(10); | ||
new DerivedMapper2().IntToLong(10).Should().Be(10L); | ||
new DerivedMapper2().IntToShort(10).Should().Be(10); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/Riok.Mapperly.IntegrationTests/Mapper/DerivedMapper.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,26 @@ | ||
using Riok.Mapperly.Abstractions; | ||
|
||
namespace Riok.Mapperly.IntegrationTests.Mapper | ||
{ | ||
[Mapper] | ||
public partial class BaseMapper | ||
{ | ||
public virtual partial long IntToLong(int value); | ||
|
||
public partial short IntToShort(int value); | ||
} | ||
|
||
[Mapper] | ||
public partial class DerivedMapper : BaseMapper | ||
{ | ||
public override partial long IntToLong(int value); | ||
} | ||
|
||
[Mapper] | ||
public partial class DerivedMapper2 : BaseMapper | ||
{ | ||
public sealed override partial long IntToLong(int value); | ||
|
||
public new partial short IntToShort(int value); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...tegrationTests/_snapshots/DerivedMapperTest.SnapshotGeneratedSourceBaseMapper.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,17 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
namespace Riok.Mapperly.IntegrationTests.Mapper | ||
{ | ||
public partial class BaseMapper | ||
{ | ||
public virtual partial long IntToLong(int value) | ||
{ | ||
return (long)value; | ||
} | ||
|
||
public partial short IntToShort(int value) | ||
{ | ||
return (short)value; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...rationTests/_snapshots/DerivedMapperTest.SnapshotGeneratedSourceDerivedMapper.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,12 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
namespace Riok.Mapperly.IntegrationTests.Mapper | ||
{ | ||
public partial class DerivedMapper | ||
{ | ||
public override partial long IntToLong(int value) | ||
{ | ||
return (long)value; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ationTests/_snapshots/DerivedMapperTest.SnapshotGeneratedSourceDerivedMapper2.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,17 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
namespace Riok.Mapperly.IntegrationTests.Mapper | ||
{ | ||
public partial class DerivedMapper2 | ||
{ | ||
public sealed override partial long IntToLong(int value) | ||
{ | ||
return (long)value; | ||
} | ||
|
||
public new partial short IntToShort(int value) | ||
{ | ||
return (short)value; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.