chore: initial commit
Signed-off-by: Alan Brault <alan.brault@visus.io>
This commit is contained in:
9
tests/.editorconfig
Normal file
9
tests/.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
16
tests/Directory.Build.props
Normal file
16
tests/Directory.Build.props
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(CI)' == 'true'">
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
<RestoreLockedMode>true</RestoreLockedMode>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
16
tests/MapperSourceGen.SourceGenerator.Tests/Constants.cs
Normal file
16
tests/MapperSourceGen.SourceGenerator.Tests/Constants.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace MapperSourceGen.SourceGenerator.Tests;
|
||||
|
||||
internal static class Constants
|
||||
{
|
||||
public const string AutoGeneratedStatement = """
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
""";
|
||||
}
|
||||
39
tests/MapperSourceGen.SourceGenerator.Tests/Fixture.cs
Normal file
39
tests/MapperSourceGen.SourceGenerator.Tests/Fixture.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace MapperSourceGen.SourceGenerator.Tests;
|
||||
|
||||
using System.Reflection;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
|
||||
internal static class Fixture
|
||||
{
|
||||
private static readonly Type[] RequiredAssemblies =
|
||||
[
|
||||
typeof(Binder),
|
||||
typeof(MapperAttribute)
|
||||
];
|
||||
|
||||
private static IEnumerable<MetadataReference> AssemblyReferencesForCodeGen =>
|
||||
AppDomain.CurrentDomain
|
||||
.GetAssemblies()
|
||||
.Concat(RequiredAssemblies.Select(s => s.Assembly))
|
||||
.Distinct()
|
||||
.Where(w => !w.IsDynamic)
|
||||
.Select(s => MetadataReference.CreateFromFile(s.Location));
|
||||
|
||||
public static Task VerifyGenerateSourcesAsync(string source, params IIncrementalGenerator[] generators)
|
||||
{
|
||||
var syntaxTree = CSharpSyntaxTree.ParseText(source, CSharpParseOptions.Default);
|
||||
|
||||
var compilation = CSharpCompilation.Create(
|
||||
"compilation",
|
||||
[syntaxTree],
|
||||
AssemblyReferencesForCodeGen,
|
||||
new CSharpCompilationOptions(OutputKind.ConsoleApplication));
|
||||
|
||||
var driver = CSharpGeneratorDriver.Create(generators);
|
||||
var runner = driver.RunGenerators(compilation);
|
||||
var verify = Verify(runner);
|
||||
|
||||
return verify;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace MapperSourceGen.SourceGenerator.Tests;
|
||||
|
||||
public sealed class MapperGeneratorFacts
|
||||
{
|
||||
[Fact]
|
||||
public Task Should_Emit_Dto_And_Mapper()
|
||||
{
|
||||
const string source = """
|
||||
namespace MapperSourceGen.SourceGenerator.Tests;
|
||||
|
||||
[Mapper]
|
||||
partial class MyEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
return Fixture.VerifyGenerateSourcesAsync(source, new MapperGenerator());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.msbuild">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="JunitXml.TestLogger" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="Verify.DiffPlex" />
|
||||
<PackageReference Include="Verify.SourceGenerators" />
|
||||
<PackageReference Include="Verify.Xunit" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\MapperSourceGen\MapperSourceGen.csproj"/>
|
||||
|
||||
<!--
|
||||
When referencing a source generator that is part of the solution for tests, ensure that the following properties are set:
|
||||
|
||||
- OutputItemType="Analyzer" to treat it as an analyzer.
|
||||
- SetTargetFramework="TargetFramework=netstandard2.0" to ensure compatibility with the source generator.
|
||||
-->
|
||||
<ProjectReference Include="..\..\src\MapperSourceGen.SourceGenerator\MapperSourceGen.SourceGenerator.csproj"
|
||||
OutputItemType="Analyzer"
|
||||
SetTargetFramework="TargetFramework=netstandard2.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace MapperSourceGen.SourceGenerator.Tests;
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using VerifyTests.DiffPlex;
|
||||
|
||||
public static class ModuleInitializer
|
||||
{
|
||||
#pragma warning disable CA2255
|
||||
[ModuleInitializer]
|
||||
#pragma warning restore CA2255
|
||||
public static void Initialize()
|
||||
{
|
||||
DerivePathInfo((file, _, type, method) => new PathInfo(Path.Combine(Path.GetDirectoryName(file)!, "ref"), type.Name, method.Name));
|
||||
|
||||
VerifySourceGenerators.Initialize();
|
||||
VerifyDiffPlex.Initialize(OutputType.Compact);
|
||||
}
|
||||
}
|
||||
254
tests/MapperSourceGen.SourceGenerator.Tests/packages.lock.json
Normal file
254
tests/MapperSourceGen.SourceGenerator.Tests/packages.lock.json
Normal file
@@ -0,0 +1,254 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dependencies": {
|
||||
"net8.0": {
|
||||
"coverlet.collector": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.4, )",
|
||||
"resolved": "6.0.4",
|
||||
"contentHash": "lkhqpF8Pu2Y7IiN7OntbsTtdbpR1syMsm2F3IgX6ootA4ffRqWL5jF7XipHuZQTdVuWG/gVAAcf8mjk8Tz0xPg=="
|
||||
},
|
||||
"coverlet.msbuild": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.4, )",
|
||||
"resolved": "6.0.4",
|
||||
"contentHash": "Qa7Hg+wrOMDKpXVn2dw4Wlun490bIWsFW0fdNJQFJLZnbU27MCP0HJ2mPgS+3EQBQUb0zKlkwiQzP+j38Hc3Iw=="
|
||||
},
|
||||
"JunitXml.TestLogger": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.1.0, )",
|
||||
"resolved": "6.1.0",
|
||||
"contentHash": "a3ciawoHOzqcry7yS5z9DerNyF9QZi6fEZZJPILSy6Noj6+r8Ydma+cENA6wvivXDCblpXxw72wWT9QApNy/0w=="
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Common": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.11.0, )",
|
||||
"resolved": "4.11.0",
|
||||
"contentHash": "djf8ujmqYImFgB04UGtcsEhHrzVqzHowS+EEl/Yunc5LdrYrZhGBWUTXoCF0NzYXJxtfuD+UVQarWpvrNc94Qg==",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
|
||||
"System.Collections.Immutable": "8.0.0",
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.11.0, 4.11.0]",
|
||||
"resolved": "4.11.0",
|
||||
"contentHash": "6XYi2EusI8JT4y2l/F3VVVS+ISoIX9nqHsZRaG6W5aFeJ5BEuBosHfT/ABb73FN0RZ1Z3cj2j7cL28SToJPXOw==",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
|
||||
"Microsoft.CodeAnalysis.Common": "[4.11.0]",
|
||||
"System.Collections.Immutable": "8.0.0",
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.14.1, )",
|
||||
"resolved": "17.14.1",
|
||||
"contentHash": "HJKqKOE+vshXra2aEHpi2TlxYX7Z9VFYkr+E5rwEvHC8eIXiyO+K9kNm8vmNom3e2rA56WqxU+/N9NJlLGXsJQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeCoverage": "17.14.1",
|
||||
"Microsoft.TestPlatform.TestHost": "17.14.1"
|
||||
}
|
||||
},
|
||||
"Verify.DiffPlex": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.1.2, )",
|
||||
"resolved": "3.1.2",
|
||||
"contentHash": "ySaQ+MffcDfGWzBXB9UHppEGBqzl0L+2CxZcT04xQ3gugsN5AAjBPHkt75Ca61PlAeZCyty/p/Q9ZwaQjNOoTg==",
|
||||
"dependencies": {
|
||||
"DiffPlex": "1.7.2",
|
||||
"Verify": "27.0.0"
|
||||
}
|
||||
},
|
||||
"Verify.SourceGenerators": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.5.0, )",
|
||||
"resolved": "2.5.0",
|
||||
"contentHash": "XhAg+fJDPXDH7Ajv/J4Hv8ls0zoeK0LqjZIiOT+quwxOqdplcTuqdPx1+4p1qvYzpTdwkLxyGiIA76MzCljyAQ==",
|
||||
"dependencies": {
|
||||
"Verify": "26.5.0"
|
||||
}
|
||||
},
|
||||
"Verify.Xunit": {
|
||||
"type": "Direct",
|
||||
"requested": "[30.5.0, )",
|
||||
"resolved": "30.5.0",
|
||||
"contentHash": "S+vPvbWgcZSR/eF5O8OAlz8uXhB2Dr2uKjUKbPLa9FtC5ay0hueYGzKshHmRZJ1jay88VE1Kd2ECPNhb8p3Uyg==",
|
||||
"dependencies": {
|
||||
"Argon": "0.30.1",
|
||||
"DiffEngine": "16.2.3",
|
||||
"SimpleInfoName": "3.1.2",
|
||||
"Verify": "30.5.0",
|
||||
"xunit.abstractions": "2.0.3",
|
||||
"xunit.extensibility.execution": "2.9.3"
|
||||
}
|
||||
},
|
||||
"xunit": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.9.3, )",
|
||||
"resolved": "2.9.3",
|
||||
"contentHash": "TlXQBinK35LpOPKHAqbLY4xlEen9TBafjs0V5KnA4wZsoQLQJiirCR4CbIXvOH8NzkW4YeJKP5P/Bnrodm0h9Q==",
|
||||
"dependencies": {
|
||||
"xunit.analyzers": "1.18.0",
|
||||
"xunit.assert": "2.9.3",
|
||||
"xunit.core": "[2.9.3]"
|
||||
}
|
||||
},
|
||||
"xunit.runner.visualstudio": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.1.3, )",
|
||||
"resolved": "3.1.3",
|
||||
"contentHash": "go7e81n/UI3LeNqoJIJ3thkS4JfJtiQnDbAxLh09JkJqoHthnfbLS5p68s4/Bm12B9umkoYSB5SaDr68hZNleg=="
|
||||
},
|
||||
"Argon": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.30.1",
|
||||
"contentHash": "kjKnBzxJ1Xp4Sh9B7inrP1YjefXH4X8hV4/J5EoDKloog09Kp4KUVoJS8xxYfUbUzJ+Xe5PKZm3hj5pi4ZuCZw=="
|
||||
},
|
||||
"DiffEngine": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.2.3",
|
||||
"contentHash": "QWnG0MR3//Ss0G0N9mIfe1HLOrOIRZqau0AOiLt9Gm53ZQf/TLvzoccTkczEW5ACkbhRY5m+p+W7bzFVln2GDw==",
|
||||
"dependencies": {
|
||||
"EmptyFiles": "8.10.1",
|
||||
"System.Management": "8.0.0"
|
||||
}
|
||||
},
|
||||
"DiffPlex": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.7.2",
|
||||
"contentHash": "qJEjdxEDBWSFZGB8paBB9HDeJXHGlHlOXeGX3kbTuXWuOsgv2iSAEOOzo5V1/B39Vcxr9IVVrNKewRcX+rsn4g=="
|
||||
},
|
||||
"EmptyFiles": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.10.1",
|
||||
"contentHash": "vhLPAqdKuo2qjVkrJbCyacGXO9XTha7G1R5amw44m877FDR/gqFjCfdncj8VyHAC6eNqrCXgYTbHJGO5+l3TJg=="
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Analyzers": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.3.4",
|
||||
"contentHash": "AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g=="
|
||||
},
|
||||
"Microsoft.CodeCoverage": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
"contentHash": "pmTrhfFIoplzFVbhVwUquT+77CbGH+h4/3mBpdmIlYtBi9nAB+kKI6dN3A/nV4DFi3wLLx/BlHIPK+MkbQ6Tpg=="
|
||||
},
|
||||
"Microsoft.TestPlatform.ObjectModel": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
"contentHash": "xTP1W6Mi6SWmuxd3a+jj9G9UoC850WGwZUps1Wah9r1ZxgXhdJfj1QqDLJkFjHDCvN42qDL2Ps5KjQYWUU0zcQ==",
|
||||
"dependencies": {
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.TestPlatform.TestHost": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
"contentHash": "d78LPzGKkJwsJXAQwsbJJ7LE7D1wB+rAyhHHAaODF+RDSQ0NgMjDFkSA1Djw18VrxO76GlKAjRUhl+H8NL8Z+Q==",
|
||||
"dependencies": {
|
||||
"Microsoft.TestPlatform.ObjectModel": "17.14.1",
|
||||
"Newtonsoft.Json": "13.0.3"
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json": {
|
||||
"type": "Transitive",
|
||||
"resolved": "13.0.3",
|
||||
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
|
||||
},
|
||||
"SimpleInfoName": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.1.2",
|
||||
"contentHash": "/OoEZQxSW6DeTJ9nfrg8BLCOCWpxBiWHV4NkG3t+Xpe8tvzm7yCwKwxkhpauMl3fg9OjlIjJMKX61H6VavLkrw=="
|
||||
},
|
||||
"System.CodeDom": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "WTlRjL6KWIMr/pAaq3rYqh0TJlzpouaQ/W1eelssHgtlwHAH25jXTkUphTYx9HaIIf7XA6qs/0+YhtLEQRkJ+Q=="
|
||||
},
|
||||
"System.Collections.Immutable": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
|
||||
},
|
||||
"System.Management": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "jrK22i5LRzxZCfGb+tGmke2VH7oE0DvcDlJ1HAKYU8cPmD8XnpUT0bYn2Gy98GEhGjtfbR/sxKTVb+dE770pfA==",
|
||||
"dependencies": {
|
||||
"System.CodeDom": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.Reflection.Metadata": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Verify": {
|
||||
"type": "Transitive",
|
||||
"resolved": "30.5.0",
|
||||
"contentHash": "AO3l7Rmw8Ry8rpVMQ98Q3MVO2G0KGiXlxyOPAYuE7NeN33JzNLJSjri/fMQDo3sm4aIwBjWbomssy2EbyJBdrg==",
|
||||
"dependencies": {
|
||||
"Argon": "0.30.1",
|
||||
"DiffEngine": "16.2.3",
|
||||
"SimpleInfoName": "3.1.2"
|
||||
}
|
||||
},
|
||||
"xunit.abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.3",
|
||||
"contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg=="
|
||||
},
|
||||
"xunit.analyzers": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.18.0",
|
||||
"contentHash": "OtFMHN8yqIcYP9wcVIgJrq01AfTxijjAqVDy/WeQVSyrDC1RzBWeQPztL49DN2syXRah8TYnfvk035s7L95EZQ=="
|
||||
},
|
||||
"xunit.assert": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.9.3",
|
||||
"contentHash": "/Kq28fCE7MjOV42YLVRAJzRF0WmEqsmflm0cfpMjGtzQ2lR5mYVj1/i0Y8uDAOLczkL3/jArrwehfMD0YogMAA=="
|
||||
},
|
||||
"xunit.core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.9.3",
|
||||
"contentHash": "BiAEvqGvyme19wE0wTKdADH+NloYqikiU0mcnmiNyXaF9HyHmE6sr/3DC5vnBkgsWaE6yPyWszKSPSApWdRVeQ==",
|
||||
"dependencies": {
|
||||
"xunit.extensibility.core": "[2.9.3]",
|
||||
"xunit.extensibility.execution": "[2.9.3]"
|
||||
}
|
||||
},
|
||||
"xunit.extensibility.core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.9.3",
|
||||
"contentHash": "kf3si0YTn2a8J8eZNb+zFpwfoyvIrQ7ivNk5ZYA5yuYk1bEtMe4DxJ2CF/qsRgmEnDr7MnW1mxylBaHTZ4qErA==",
|
||||
"dependencies": {
|
||||
"xunit.abstractions": "2.0.3"
|
||||
}
|
||||
},
|
||||
"xunit.extensibility.execution": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.9.3",
|
||||
"contentHash": "yMb6vMESlSrE3Wfj7V6cjQ3S4TXdXpRqYeNEI3zsX31uTsGMJjEw6oD5F5u1cHnMptjhEECnmZSsPxB6ChZHDQ==",
|
||||
"dependencies": {
|
||||
"xunit.extensibility.core": "[2.9.3]"
|
||||
}
|
||||
},
|
||||
"mappersourcegen": {
|
||||
"type": "Project"
|
||||
},
|
||||
"mappersourcegen.sourcegenerator": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.CSharp": "[4.11.0, 4.11.0]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//HintName: MapperSourceGen.SourceGenerator.Tests.MyEntityDto.g.cs
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
#nullable enable
|
||||
namespace MapperSourceGen.SourceGenerator.Tests
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal partial class MyEntityDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//HintName: MapperSourceGen.SourceGenerator.Tests.MyEntityMapper.g.cs
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
#nullable enable
|
||||
namespace MapperSourceGen.SourceGenerator.Tests
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal partial class MyEntityMapper
|
||||
{
|
||||
public static MapperSourceGen.SourceGenerator.Tests.MyEntity ToModel(MapperSourceGen.SourceGenerator.Tests.MyEntityDto source)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(nameof(source));
|
||||
return new MapperSourceGen.SourceGenerator.Tests.MyEntity()
|
||||
{
|
||||
Id = source.Id,
|
||||
};
|
||||
}
|
||||
|
||||
public static MapperSourceGen.SourceGenerator.Tests.MyEntityDto ToDto(MapperSourceGen.SourceGenerator.Tests.MyEntity source)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(nameof(source));
|
||||
return new MapperSourceGen.SourceGenerator.Tests.MyEntityDto()
|
||||
{
|
||||
Id = source.Id,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user