Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Replacing AutoMapper with Grand.Mapping (#664)

Krzysztof Pajak8bd74258173b
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5f787c5f7..667b2ed52 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -30,7 +30,6 @@
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="10.0.1" />
- <PackageVersion Include="AutoMapper" Version="14.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0" />
<PackageVersion Include="MediatR" Version="12.5.0" />
@@ -59,10 +58,11 @@
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Moq" Version="4.20.72" />
- <PackageVersion Include="MSTest.TestAdapter" Version="4.0.2" />
- <PackageVersion Include="MSTest.TestFramework" Version="4.0.2" />
+ <PackageVersion Include="MSTest.TestAdapter" Version="4.1.0" />
+ <PackageVersion Include="MSTest.TestFramework" Version="4.1.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="NUnit" Version="4.4.0" />
+ <PackageVersion Include="Verify.MSTest" Version="31.13.5" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.1.0" />
<PackageVersion Include="Aspire.Hosting.MongoDB" Version="13.1.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.1.0" />
diff --git a/GrandNode.sln b/GrandNode.sln
index c6bd60b9f..20ae11d7c 100644
--- a/GrandNode.sln
+++ b/GrandNode.sln
@@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Web.Common", "src\Web
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Infrastructure", "src\Core\Grand.Infrastructure\Grand.Infrastructure.csproj", "{34A46D97-5996-46B3-BDCA-631EDAA0E210}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Mapping", "src\Core\Grand.Mapping\Grand.Mapping.csproj", "{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{F6F48227-B3C5-4A51-B33F-FF9AD96352DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.Facebook", "src\Plugins\Authentication.Facebook\Authentication.Facebook.csproj", "{BA4579AF-9C20-477A-891B-926968B11C68}"
@@ -145,6 +147,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grand.Web.AdminShared", "src\Web\Grand.Web.AdminShared\Grand.Web.AdminShared.csproj", "{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grand.Mapping.Tests", "src\Tests\Grand.Mapping.Tests\Grand.Mapping.Tests.csproj", "{396E6929-5365-4116-8AA8-DF5327247798}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{03997797-E7F5-0643-168D-B8EA7178C2FE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{EC447DCF-ABFA-6E24-52A5-D7FD48A5C558}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Business", "Business", "{CC1F4FA2-92F2-BA4B-815B-7EC2CBBCCF50}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -323,6 +335,18 @@ Global
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x64.Build.0 = Release|Any CPU
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x86.ActiveCfg = Release|Any CPU
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x86.Build.0 = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x64.Build.0 = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x86.Build.0 = Debug|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x64.ActiveCfg = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x64.Build.0 = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x86.ActiveCfg = Release|Any CPU
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x86.Build.0 = Release|Any CPU
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -863,6 +887,18 @@ Global
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x64.Build.0 = Release|Any CPU
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x86.ActiveCfg = Release|Any CPU
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x86.Build.0 = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|x64.Build.0 = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Debug|x86.Build.0 = Debug|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|Any CPU.Build.0 = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|x64.ActiveCfg = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|x64.Build.0 = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|x86.ActiveCfg = Release|Any CPU
+ {396E6929-5365-4116-8AA8-DF5327247798}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -882,6 +918,7 @@ Global
{D2E8AC42-2751-4AF9-87E4-54A8B2034360} = {6EAC4D2C-4A86-4C9F-8427-CB374F69F08C}
{1A6A0104-F610-4DD3-88BE-C4029034E5DA} = {BF4543A8-0731-4FDD-BB6B-0ADB9561F981}
{34A46D97-5996-46B3-BDCA-631EDAA0E210} = {FA350BD6-C29D-40D9-BA47-FE5FBDFC84A0}
+ {D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9} = {FA350BD6-C29D-40D9-BA47-FE5FBDFC84A0}
{BA4579AF-9C20-477A-891B-926968B11C68} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
{6F24BF9C-EA4E-42AB-A9A8-435CE69362B8} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
{64775F93-5A04-495F-97C6-BDB3835B18F6} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
@@ -926,6 +963,10 @@ Global
{E0B26803-010B-4198-8016-002242076B61} = {583FFBBD-421C-4FB7-BBDA-F9CAF35A354A}
{136F1E35-8B20-465C-8D42-30A5A0D0DA1F} = {583FFBBD-421C-4FB7-BBDA-F9CAF35A354A}
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430} = {BF4543A8-0731-4FDD-BB6B-0ADB9561F981}
+ {396E6929-5365-4116-8AA8-DF5327247798} = {6360202A-F931-4BBD-ADBD-C9A628EE59F8}
+ {03997797-E7F5-0643-168D-B8EA7178C2FE} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
+ {EC447DCF-ABFA-6E24-52A5-D7FD48A5C558} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
+ {CC1F4FA2-92F2-BA4B-815B-7EC2CBBCCF50} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {88B478F4-FD3B-4C24-9E84-4FAAF0254397}
diff --git a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/BrandProfile.cs b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/BrandProfile.cs
index e2dbaca30..090937991 100644
--- a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/BrandProfile.cs
+++ b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/BrandProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Dto;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CategoryProfile.cs b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CategoryProfile.cs
index 383bfe4a1..3659da20c 100644
--- a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CategoryProfile.cs
+++ b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Dto;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CollectionProfile.cs b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CollectionProfile.cs
index 0e72900d6..21356d7cf 100644
--- a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CollectionProfile.cs
+++ b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CollectionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Dto;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/ProductProfile.cs b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/ProductProfile.cs
index d6fe0798c..dd5a3a775 100644
--- a/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/ProductProfile.cs
+++ b/src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/ProductProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Dto;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj b/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
index 806f5ef2f..c2d4600b1 100644
--- a/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
+++ b/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
@@ -8,7 +8,6 @@
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" />
- <PackageReference Include="AutoMapper" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" />
<PackageReference Include="MediatR" />
@@ -20,5 +19,6 @@
<ItemGroup>
<ProjectReference Include="..\Grand.Data\Grand.Data.csproj" />
<ProjectReference Include="..\Grand.Domain\Grand.Domain.csproj" />
+ <ProjectReference Include="..\Grand.Mapping\Grand.Mapping.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/Core/Grand.Infrastructure/Mapper/AutoMapperConfig.cs b/src/Core/Grand.Infrastructure/Mapper/AutoMapperConfig.cs
index 9d32a43de..48d56acef 100644
--- a/src/Core/Grand.Infrastructure/Mapper/AutoMapperConfig.cs
+++ b/src/Core/Grand.Infrastructure/Mapper/AutoMapperConfig.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
namespace Grand.Infrastructure.Mapper;
diff --git a/src/Core/Grand.Infrastructure/Mapper/MappingExtensions.cs b/src/Core/Grand.Infrastructure/Mapper/MappingExtensions.cs
index 9f0fc981a..806e0676e 100644
--- a/src/Core/Grand.Infrastructure/Mapper/MappingExtensions.cs
+++ b/src/Core/Grand.Infrastructure/Mapper/MappingExtensions.cs
@@ -2,7 +2,7 @@
public static class MappingExtensions
{
- public static TDestination MapTo<TSource, TDestination>(this TSource source)
+ public static TDestination MapTo<TSource, TDestination>(this TSource source) where TDestination : new()
{
return AutoMapperConfig.Mapper.Map<TSource, TDestination>(source);
}
diff --git a/src/Core/Grand.Infrastructure/StartupBase.cs b/src/Core/Grand.Infrastructure/StartupBase.cs
index 33f1c35d8..34b6dc411 100644
--- a/src/Core/Grand.Infrastructure/StartupBase.cs
+++ b/src/Core/Grand.Infrastructure/StartupBase.cs
@@ -1,5 +1,5 @@
-using AutoMapper;
-using Grand.Data;
+using Grand.Data;
+using Grand.Mapping;
using Grand.Infrastructure.Configuration;
using Grand.Infrastructure.Extensions;
using Grand.Infrastructure.Mapper;
@@ -67,7 +67,7 @@ public static class StartupBase
//create AutoMapper configuration
var config = new MapperConfiguration(cfg =>
{
- foreach (var instance in instances) cfg.AddProfile(instance.GetType());
+ foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
});
//register automapper
diff --git a/src/Core/Grand.Mapping/Grand.Mapping.csproj b/src/Core/Grand.Mapping/Grand.Mapping.csproj
new file mode 100644
index 000000000..b9b0d198f
--- /dev/null
+++ b/src/Core/Grand.Mapping/Grand.Mapping.csproj
@@ -0,0 +1,3 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="..\..\Build\Grand.Common.props" />
+</Project>
diff --git a/src/Core/Grand.Mapping/GrandMapper.cs b/src/Core/Grand.Mapping/GrandMapper.cs
new file mode 100644
index 000000000..08771d597
--- /dev/null
+++ b/src/Core/Grand.Mapping/GrandMapper.cs
@@ -0,0 +1,25 @@
+using System.Collections.Frozen;
+
+namespace Grand.Mapping;
+
+internal sealed class GrandMapper : IMapper
+{
+ private readonly FrozenDictionary<(Type, Type), Delegate> _mappings;
+
+ internal GrandMapper(Dictionary<(Type, Type), Delegate> mappings)
+ => _mappings = mappings.ToFrozenDictionary();
+
+ public TDest Map<TSource, TDest>(TSource source) where TDest : new()
+ {
+ return Map(source, new TDest());
+ }
+
+ public TDest Map<TSource, TDest>(TSource source, TDest destination)
+ {
+ ArgumentNullException.ThrowIfNull(source);
+ ArgumentNullException.ThrowIfNull(destination);
+ if (_mappings.TryGetValue((typeof(TSource), typeof(TDest)), out var del))
+ ((Action<TSource, TDest>)del)(source, destination);
+ return destination;
+ }
+}
diff --git a/src/Core/Grand.Mapping/IMapper.cs b/src/Core/Grand.Mapping/IMapper.cs
new file mode 100644
index 000000000..9809f155d
--- /dev/null
+++ b/src/Core/Grand.Mapping/IMapper.cs
@@ -0,0 +1,7 @@
+namespace Grand.Mapping;
+
+public interface IMapper
+{
+ TDest Map<TSource, TDest>(TSource source) where TDest : new();
+ TDest Map<TSource, TDest>(TSource source, TDest destination);
+}
diff --git a/src/Core/Grand.Mapping/IMapperConfigurationExpression.cs b/src/Core/Grand.Mapping/IMapperConfigurationExpression.cs
new file mode 100644
index 000000000..de4d21743
--- /dev/null
+++ b/src/Core/Grand.Mapping/IMapperConfigurationExpression.cs
@@ -0,0 +1,7 @@
+namespace Grand.Mapping;
+
+public interface IMapperConfigurationExpression
+{
+ void AddProfile(Profile profile);
+ void AddProfile<T>() where T : Profile, new() => AddProfile(new T());
+}
diff --git a/src/Core/Grand.Mapping/IMappingExpression.cs b/src/Core/Grand.Mapping/IMappingExpression.cs
new file mode 100644
index 000000000..8ee91b5a2
--- /dev/null
+++ b/src/Core/Grand.Mapping/IMappingExpression.cs
@@ -0,0 +1,14 @@
+using System.Linq.Expressions;
+
+namespace Grand.Mapping;
+
+public interface IMappingExpression<TSource, TDest>
+{
+ IMappingExpression<TSource, TDest> ForMember<TMember>(
+ Expression<Func<TDest, TMember>> destMember,
+ Action<IMemberConfigurationExpression<TSource, TDest, TMember>> opts);
+
+ IMappingExpression<TSource, TDest> ForPath<TMember>(
+ Expression<Func<TDest, TMember>> destPath,
+ Action<IMemberConfigurationExpression<TSource, TDest, TMember>> opts);
+}
diff --git a/src/Core/Grand.Mapping/IMemberConfigurationExpression.cs b/src/Core/Grand.Mapping/IMemberConfigurationExpression.cs
new file mode 100644
index 000000000..2e73fc566
--- /dev/null
+++ b/src/Core/Grand.Mapping/IMemberConfigurationExpression.cs
@@ -0,0 +1,10 @@
+using System.Linq.Expressions;
+
+namespace Grand.Mapping;
+
+public interface IMemberConfigurationExpression<TSource, TDest, TMember>
+{
+ void Ignore();
+ void MapFrom<TResult>(Expression<Func<TSource, TResult>> mapExpression);
+ void Condition(Expression<Func<TSource, bool>> condition);
+}
diff --git a/src/Core/Grand.Mapping/Internal/IMappingConfiguration.cs b/src/Core/Grand.Mapping/Internal/IMappingConfiguration.cs
new file mode 100644
index 000000000..5a9aab102
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/IMappingConfiguration.cs
@@ -0,0 +1,7 @@
+namespace Grand.Mapping.Internal;
+
+internal interface IMappingConfiguration
+{
+ (Type Source, Type Dest) GetTypes();
+ Delegate CompileDelegate(HashSet<(Type, Type)> registeredTypes, Dictionary<(Type, Type), Delegate> mappings);
+}
diff --git a/src/Core/Grand.Mapping/Internal/MapperConfigurationExpressionImpl.cs b/src/Core/Grand.Mapping/Internal/MapperConfigurationExpressionImpl.cs
new file mode 100644
index 000000000..f107add3f
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/MapperConfigurationExpressionImpl.cs
@@ -0,0 +1,11 @@
+namespace Grand.Mapping.Internal;
+
+internal sealed class MapperConfigurationExpressionImpl : IMapperConfigurationExpression
+{
+ private readonly List<IMappingConfiguration> _configurations = new();
+
+ public void AddProfile(Profile profile)
+ => _configurations.AddRange(profile.GetConfigurations());
+
+ internal IEnumerable<IMappingConfiguration> GetConfigurations() => _configurations;
+}
diff --git a/src/Core/Grand.Mapping/Internal/MappingCompiler.cs b/src/Core/Grand.Mapping/Internal/MappingCompiler.cs
new file mode 100644
index 000000000..3cb4bde0c
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/MappingCompiler.cs
@@ -0,0 +1,373 @@
+#nullable enable
+
+using System.Linq.Expressions;
+using System.Reflection;
+
+namespace Grand.Mapping.Internal;
+
+internal static class MappingCompiler
+{
+ private static readonly MethodInfo _dictGetItemMethod =
+ typeof(Dictionary<(Type, Type), Delegate>).GetMethod("get_Item")!;
+
+ public static Action<TSource, TDest> Compile<TSource, TDest>(
+ List<MemberConfig> configs,
+ HashSet<(Type, Type)> registeredTypes,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var src = Expression.Parameter(typeof(TSource), "src");
+ var dst = Expression.Parameter(typeof(TDest), "dst");
+ var body = new List<Expression>();
+
+ var direct = BuildDirectConfigLookup(configs);
+
+ foreach (var dp in typeof(TDest)
+ .GetProperties(BindingFlags.Public | BindingFlags.Instance)
+ .Where(p => p.CanWrite))
+ {
+ var destAccess = Expression.Property(dst, dp);
+ if (direct.TryGetValue(dp.Name, out var mc))
+ ProcessMappedProperty(body, dp, mc, src, destAccess, registeredTypes, mappings);
+ else
+ ProcessAutoProperty(body, dp, src, destAccess, registeredTypes, mappings);
+ }
+
+ ProcessForPaths(body, configs, src, dst);
+
+ return Expression.Lambda<Action<TSource, TDest>>(
+ body.Count > 0 ? (Expression)Expression.Block(body) : Expression.Empty(),
+ src, dst).Compile();
+ }
+
+ private static Dictionary<string, MemberConfig> BuildDirectConfigLookup(List<MemberConfig> configs)
+ {
+ var direct = new Dictionary<string, MemberConfig>(StringComparer.Ordinal);
+ foreach (var c in configs.Where(c => !c.IsPath))
+ direct[c.MemberName] = c;
+ return direct;
+ }
+
+ private static void ProcessMappedProperty(
+ List<Expression> body, PropertyInfo dp, MemberConfig mc,
+ ParameterExpression src, Expression destAccess,
+ HashSet<(Type, Type)> registeredTypes,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ if (mc.IsIgnored) return;
+
+ var value = mc.MapFromExpression != null
+ ? InlineLambda(mc.MapFromExpression, src)
+ : SourceProp(src, dp.Name);
+
+ if (value == null) return;
+
+ var expr = BuildAssignOrNested(value, destAccess, dp.PropertyType,
+ mc.ConditionExpression, src, registeredTypes, mappings);
+ if (expr != null) body.Add(expr);
+ }
+
+ private static void ProcessAutoProperty(
+ List<Expression> body, PropertyInfo dp,
+ ParameterExpression src, Expression destAccess,
+ HashSet<(Type, Type)> registeredTypes,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var srcExpr = SourceProp(src, dp.Name);
+ if (srcExpr == null) return;
+
+ var expr = BuildAssignOrNested(srcExpr, destAccess, dp.PropertyType,
+ null, src, registeredTypes, mappings);
+ if (expr != null) body.Add(expr);
+ }
+
+ private static Expression? BuildAssignOrNested(
+ Expression value, Expression destAccess, Type destType,
+ LambdaExpression? condition, ParameterExpression src,
+ HashSet<(Type, Type)> registeredTypes,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var coerced = Coerce(value, destType);
+ if (coerced != null)
+ return WrapWithCondition(Expression.Assign(destAccess, coerced), condition, src);
+
+ return BuildNestedMapping(value, destAccess, destType, condition, src, registeredTypes, mappings);
+ }
+
+ private static void ProcessForPaths(
+ List<Expression> body, List<MemberConfig> configs,
+ ParameterExpression src, ParameterExpression dst)
+ {
+ foreach (var pc in configs.Where(c => c.IsPath && !c.IsIgnored
+ && c.MapFromExpression != null && c.DestinationPathExpression != null))
+ {
+ var expr = BuildForPathExpression(pc, src, dst);
+ if (expr != null) body.Add(expr);
+ }
+ }
+
+ private static Expression? BuildForPathExpression(
+ MemberConfig pc, ParameterExpression src, ParameterExpression dst)
+ {
+ var destAccess = SubstitutePath(pc.DestinationPathExpression!, dst);
+ if (destAccess == null) return null;
+
+ var value = Coerce(InlineLambda(pc.MapFromExpression!, src), destAccess.Type);
+ if (value == null) return null;
+
+ return WrapWithCondition(Expression.Assign(destAccess, value), pc.ConditionExpression, src);
+ }
+
+ private static Expression WrapWithCondition(
+ Expression expr, LambdaExpression? condition, ParameterExpression src)
+ => condition != null
+ ? Expression.IfThen(InlineLambda(condition, src), expr)
+ : expr;
+
+ private static Expression? BuildNestedMapping(
+ Expression srcValueExpr,
+ Expression destAccess,
+ Type destType,
+ LambdaExpression? condition,
+ ParameterExpression srcParam,
+ HashSet<(Type, Type)> registeredTypes,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var srcType = srcValueExpr.Type;
+
+ if (IsDirectObjectMapping(srcType, destType, registeredTypes))
+ {
+ var innerBlock = BuildDirectObjectMappingBlock(
+ srcValueExpr, destAccess, srcType, destType, mappings);
+ return WrapWithCondition(innerBlock, condition, srcParam);
+ }
+
+ var srcElem = CollectionElementType(srcType);
+ var dstElem = CollectionElementType(destType);
+ if (srcElem != null && dstElem != null && srcElem != dstElem
+ && registeredTypes.Contains((srcElem, dstElem)))
+ {
+ var converted = BuildCrossTypeCollectionCoerce(srcValueExpr, destType, srcElem, dstElem, mappings);
+ return WrapWithCondition(Expression.Assign(destAccess, converted), condition, srcParam);
+ }
+
+ return null;
+ }
+
+ private static bool IsDirectObjectMapping(
+ Type srcType, Type destType, HashSet<(Type, Type)> registeredTypes)
+ => !srcType.IsValueType && !destType.IsValueType
+ && CollectionElementType(srcType) == null
+ && CollectionElementType(destType) == null
+ && destType.GetConstructor(Type.EmptyTypes) != null
+ && registeredTypes.Contains((srcType, destType));
+
+ private static Expression BuildDirectObjectMappingBlock(
+ Expression srcValueExpr, Expression destAccess,
+ Type srcType, Type destType,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var castDel = Expression.Convert(
+ Expression.Call(Expression.Constant(mappings), _dictGetItemMethod,
+ Expression.Constant((srcType, destType))),
+ typeof(Action<,>).MakeGenericType(srcType, destType));
+
+ var srcVar = Expression.Variable(srcType, "ns");
+ var tmpVar = Expression.Variable(destType, "nd");
+
+ return Expression.Block(
+ new[] { srcVar, tmpVar },
+ Expression.Assign(srcVar, srcValueExpr),
+ Expression.IfThen(
+ Expression.ReferenceNotEqual(srcVar, Expression.Constant(null, srcType)),
+ Expression.Block(
+ Expression.Assign(tmpVar, Expression.New(destType)),
+ Expression.Invoke(castDel, srcVar, tmpVar),
+ Expression.Assign(destAccess, tmpVar))));
+ }
+
+ private static Expression BuildCrossTypeCollectionCoerce(
+ Expression src,
+ Type destType,
+ Type srcElem,
+ Type dstElem,
+ Dictionary<(Type, Type), Delegate> mappings)
+ {
+ var delConst = Expression.Constant(mappings);
+ var keyConst = Expression.Constant((srcElem, dstElem));
+ var getDel = Expression.Call(
+ delConst,
+ _dictGetItemMethod,
+ keyConst);
+ var castDel = Expression.Convert(getDel, typeof(Action<,>).MakeGenericType(srcElem, dstElem));
+
+ var xParam = Expression.Parameter(srcElem, "x");
+ var tmpVar = Expression.Variable(dstElem, "tmp");
+ var selectorBody = Expression.Block(
+ new[] { tmpVar },
+ Expression.Assign(tmpVar, Expression.New(dstElem)),
+ Expression.Invoke(castDel, xParam, tmpVar),
+ tmpVar);
+ var selector = Expression.Lambda(selectorBody, xParam);
+
+ var iEnumSrc = typeof(IEnumerable<>).MakeGenericType(srcElem);
+ var srcCast = src.Type == iEnumSrc ? src : Expression.Convert(src, iEnumSrc);
+
+ var selectMethod = typeof(Enumerable)
+ .GetMethods()
+ .First(m => m.Name == nameof(Enumerable.Select) && m.GetParameters().Length == 2)
+ .MakeGenericMethod(srcElem, dstElem);
+
+ Expression filled;
+ if (destType.IsArray)
+ {
+ var toArray = typeof(Enumerable).GetMethod(nameof(Enumerable.ToArray))!.MakeGenericMethod(dstElem);
+ filled = Expression.Call(toArray, Expression.Call(selectMethod, srcCast, selector));
+ }
+ else
+ {
+ var toList = typeof(Enumerable).GetMethod(nameof(Enumerable.ToList))!.MakeGenericMethod(dstElem);
+ filled = Expression.Call(toList, Expression.Call(selectMethod, srcCast, selector));
+ }
+
+ Expression emptyExpr = destType.IsArray
+ ? Expression.NewArrayBounds(dstElem, Expression.Constant(0))
+ : (Expression)Expression.New(typeof(List<>).MakeGenericType(dstElem));
+
+ if (src.Type.IsValueType) return filled;
+ return Expression.Condition(
+ Expression.ReferenceEqual(src, Expression.Constant(null, src.Type)),
+ emptyExpr,
+ filled);
+ }
+
+ private static Expression InlineLambda(LambdaExpression lambda, Expression arg)
+ => new ParameterReplacer(lambda.Parameters[0], arg).Visit(lambda.Body);
+
+ private static Expression? SourceProp(ParameterExpression src, string name)
+ {
+ var sp = src.Type.GetProperty(name, BindingFlags.Public | BindingFlags.Instance);
+ return sp?.CanRead == true ? Expression.Property(src, sp) : null;
+ }
+
+ private static MemberExpression? SubstitutePath(LambdaExpression pathExpr, ParameterExpression dst)
+ {
+ var chain = new List<PropertyInfo>();
+ var node = pathExpr.Body;
+ while (node is MemberExpression me && me.Member is PropertyInfo pi)
+ {
+ chain.Insert(0, pi);
+ node = me.Expression!;
+ }
+ if (chain.Count == 0 || node is not ParameterExpression) return null;
+
+ Expression result = dst;
+ foreach (var pi in chain)
+ result = Expression.Property(result, pi);
+ return result as MemberExpression;
+ }
+
+ private static Expression? Coerce(Expression? expr, Type target)
+ {
+ if (expr == null) return null;
+ if (expr.Type == target) return expr;
+
+ // T → Nullable<T>
+ var underlyingTarget = Nullable.GetUnderlyingType(target);
+ if (underlyingTarget == expr.Type)
+ return Expression.Convert(expr, target);
+
+ return CoerceNullableToValue(expr, target)
+ ?? CoerceCollections(expr, target)
+ ?? CoerceUpcast(expr, target)
+ ?? CoerceNumericOrEnum(expr, target)
+ ?? CoerceViaConvertOperator(expr, target);
+ }
+
+ private static Expression? CoerceNullableToValue(Expression expr, Type target)
+ {
+ var underlyingSource = Nullable.GetUnderlyingType(expr.Type);
+ if (underlyingSource != target) return null;
+ return Expression.Condition(
+ Expression.Property(expr, nameof(Nullable<int>.HasValue)),
+ Expression.Property(expr, nameof(Nullable<int>.Value)),
+ Expression.Default(target));
+ }
+
+ private static Expression? CoerceCollections(Expression expr, Type target)
+ {
+ var srcElem = CollectionElementType(expr.Type);
+ var dstElem = CollectionElementType(target);
+ if (srcElem == null || dstElem == null || srcElem != dstElem) return null;
+ return BuildCollectionCoerce(expr, target, dstElem);
+ }
+
+ private static Expression? CoerceUpcast(Expression expr, Type target)
+ => target.IsAssignableFrom(expr.Type) ? expr : null;
+
+ private static Expression? CoerceNumericOrEnum(Expression expr, Type target)
+ {
+ if (!IsNumericOrEnum(expr.Type) || !IsNumericOrEnum(target)) return null;
+ try { return Expression.Convert(expr, target); } catch { return null; }
+ }
+
+ private static Expression? CoerceViaConvertOperator(Expression expr, Type target)
+ {
+ try { var c = Expression.Convert(expr, target); return c.Method != null ? c : null; }
+ catch { return null; }
+ }
+
+ private static Expression BuildCollectionCoerce(Expression src, Type target, Type elem)
+ {
+ var iEnum = typeof(IEnumerable<>).MakeGenericType(elem);
+ var srcCast = src.Type == iEnum ? src : Expression.Convert(src, iEnum);
+
+ Expression filled, empty;
+ if (target.IsArray)
+ {
+ var toArray = typeof(Enumerable).GetMethod(nameof(Enumerable.ToArray))!.MakeGenericMethod(elem);
+ filled = Expression.Call(toArray, srcCast);
+ empty = Expression.NewArrayBounds(elem, Expression.Constant(0));
+ }
+ else
+ {
+ var listType = typeof(List<>).MakeGenericType(elem);
+ var toList = typeof(Enumerable).GetMethod(nameof(Enumerable.ToList))!.MakeGenericMethod(elem);
+ filled = Expression.Call(toList, srcCast);
+ empty = Expression.New(listType);
+ }
+
+ if (src.Type.IsValueType) return filled;
+ return Expression.Condition(
+ Expression.ReferenceEqual(src, Expression.Constant(null, src.Type)),
+ empty, filled);
+ }
+
+ private static Type? CollectionElementType(Type t)
+ {
+ if (t == typeof(string)) return null;
+ if (t.IsArray && t.GetArrayRank() == 1) return t.GetElementType();
+ if (t.IsGenericType)
+ {
+ var def = t.GetGenericTypeDefinition();
+ if (def == typeof(List<>) || def == typeof(IList<>) || def == typeof(ICollection<>)
+ || def == typeof(IEnumerable<>) || def == typeof(IReadOnlyList<>)
+ || def == typeof(IReadOnlyCollection<>))
+ return t.GetGenericArguments()[0];
+ }
+ foreach (var iface in t.GetInterfaces())
+ if (iface.IsGenericType && iface.GetGenericTypeDefinition() == typeof(IEnumerable<>))
+ return iface.GetGenericArguments()[0];
+ return null;
+ }
+
+ private static bool IsNumericOrEnum(Type t)
+ {
+ t = Nullable.GetUnderlyingType(t) ?? t;
+ return t.IsEnum || t == typeof(byte) || t == typeof(sbyte)
+ || t == typeof(short) || t == typeof(ushort)
+ || t == typeof(int) || t == typeof(uint)
+ || t == typeof(long) || t == typeof(ulong)
+ || t == typeof(float) || t == typeof(double)
+ || t == typeof(decimal);
+ }
+}
diff --git a/src/Core/Grand.Mapping/Internal/MappingConfiguration.cs b/src/Core/Grand.Mapping/Internal/MappingConfiguration.cs
new file mode 100644
index 000000000..76ee1a0d3
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/MappingConfiguration.cs
@@ -0,0 +1,14 @@
+namespace Grand.Mapping.Internal;
+
+internal sealed class MappingConfiguration<TSource, TDest> : IMappingConfiguration
+{
+ private readonly MappingExpressionImpl<TSource, TDest> _expression;
+
+ public MappingConfiguration(MappingExpressionImpl<TSource, TDest> expression)
+ => _expression = expression;
+
+ public (Type Source, Type Dest) GetTypes() => (typeof(TSource), typeof(TDest));
+
+ public Delegate CompileDelegate(HashSet<(Type, Type)> registeredTypes, Dictionary<(Type, Type), Delegate> mappings)
+ => MappingCompiler.Compile<TSource, TDest>(_expression.MemberConfigs, registeredTypes, mappings);
+}
diff --git a/src/Core/Grand.Mapping/Internal/MappingExpressionImpl.cs b/src/Core/Grand.Mapping/Internal/MappingExpressionImpl.cs
new file mode 100644
index 000000000..0a6457526
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/MappingExpressionImpl.cs
@@ -0,0 +1,53 @@
+using System.Linq.Expressions;
+
+namespace Grand.Mapping.Internal;
+
+internal sealed class MappingExpressionImpl<TSource, TDest> : IMappingExpression<TSource, TDest>
+{
+ internal readonly List<MemberConfig> MemberConfigs = new();
+
+ public IMappingExpression<TSource, TDest> ForMember<TMember>(
+ Expression<Func<TDest, TMember>> destMember,
+ Action<IMemberConfigurationExpression<TSource, TDest, TMember>> opts)
+ {
+ var body = destMember.Body;
+ // Unwrap UnaryExpression conversion if present (e.g., boxing)
+ if (body is UnaryExpression unary) body = unary.Operand;
+ var config = new MemberConfig {
+ MemberName = ((MemberExpression)body).Member.Name,
+ IsPath = false
+ };
+ opts(new MemberConfigExpressionImpl<TSource, TDest, TMember>(config));
+ MemberConfigs.Add(config);
+ return this;
+ }
+
+ public IMappingExpression<TSource, TDest> ForPath<TMember>(
+ Expression<Func<TDest, TMember>> destPath,
+ Action<IMemberConfigurationExpression<TSource, TDest, TMember>> opts)
+ {
+ var config = new MemberConfig {
+ DestinationPathExpression = destPath,
+ IsPath = true
+ };
+ opts(new MemberConfigExpressionImpl<TSource, TDest, TMember>(config));
+ MemberConfigs.Add(config);
+ return this;
+ }
+}
+
+internal sealed class MemberConfigExpressionImpl<TSource, TDest, TMember>
+ : IMemberConfigurationExpression<TSource, TDest, TMember>
+{
+ private readonly MemberConfig _config;
+
+ public MemberConfigExpressionImpl(MemberConfig config) => _config = config;
+
+ public void Ignore() => _config.IsIgnored = true;
+
+ public void MapFrom<TResult>(Expression<Func<TSource, TResult>> mapExpression)
+ => _config.MapFromExpression = mapExpression;
+
+ public void Condition(Expression<Func<TSource, bool>> condition)
+ => _config.ConditionExpression = condition;
+}
diff --git a/src/Core/Grand.Mapping/Internal/MemberConfig.cs b/src/Core/Grand.Mapping/Internal/MemberConfig.cs
new file mode 100644
index 000000000..71b12113e
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/MemberConfig.cs
@@ -0,0 +1,15 @@
+#nullable enable
+
+using System.Linq.Expressions;
+
+namespace Grand.Mapping.Internal;
+
+internal sealed class MemberConfig
+{
+ public bool IsIgnored { get; set; }
+ public LambdaExpression? MapFromExpression { get; set; }
+ public LambdaExpression? ConditionExpression { get; set; }
+ public string MemberName { get; set; } = "";
+ public LambdaExpression? DestinationPathExpression { get; set; }
+ public bool IsPath { get; set; }
+}
diff --git a/src/Core/Grand.Mapping/Internal/ParameterReplacer.cs b/src/Core/Grand.Mapping/Internal/ParameterReplacer.cs
new file mode 100644
index 000000000..098177665
--- /dev/null
+++ b/src/Core/Grand.Mapping/Internal/ParameterReplacer.cs
@@ -0,0 +1,22 @@
+using System.Linq.Expressions;
+
+namespace Grand.Mapping.Internal;
+
+/// <summary>
+/// Substitutes a lambda parameter with a concrete expression, enabling body inlining
+/// instead of generating a delegate-call wrapper via Expression.Invoke.
+/// </summary>
+internal sealed class ParameterReplacer : ExpressionVisitor
+{
+ private readonly ParameterExpression _parameter;
+ private readonly Expression _replacement;
+
+ internal ParameterReplacer(ParameterExpression parameter, Expression replacement)
+ {
+ _parameter = parameter;
+ _replacement = replacement;
+ }
+
+ protected override Expression VisitParameter(ParameterExpression node)
+ => node == _parameter ? _replacement : base.VisitParameter(node);
+}
diff --git a/src/Core/Grand.Mapping/MapperConfiguration.cs b/src/Core/Grand.Mapping/MapperConfiguration.cs
new file mode 100644
index 000000000..20fa3c96c
--- /dev/null
+++ b/src/Core/Grand.Mapping/MapperConfiguration.cs
@@ -0,0 +1,30 @@
+using Grand.Mapping.Internal;
+
+namespace Grand.Mapping;
+
+public sealed class MapperConfiguration
+{
+ private readonly Dictionary<(Type, Type), Delegate> _mappings = new();
+
+ public MapperConfiguration(Action<IMapperConfigurationExpression> configure)
+ {
+ var expr = new MapperConfigurationExpressionImpl();
+ configure(expr);
+ var configs = expr.GetConfigurations().ToList();
+
+ // First pass: register all type-pair keys so nested mappings can detect
+ // forward/cross references during compilation.
+ var registeredTypes = new HashSet<(Type, Type)>(configs.Count);
+ foreach (var config in configs)
+ registeredTypes.Add(config.GetTypes());
+
+ // Second pass: compile all delegates (all keys are now registered).
+ foreach (var config in configs)
+ {
+ var key = config.GetTypes();
+ _mappings[key] = config.CompileDelegate(registeredTypes, _mappings);
+ }
+ }
+
+ public IMapper CreateMapper() => new GrandMapper(_mappings);
+}
diff --git a/src/Core/Grand.Mapping/Profile.cs b/src/Core/Grand.Mapping/Profile.cs
new file mode 100644
index 000000000..0760becdc
--- /dev/null
+++ b/src/Core/Grand.Mapping/Profile.cs
@@ -0,0 +1,17 @@
+using Grand.Mapping.Internal;
+
+namespace Grand.Mapping;
+
+public abstract class Profile
+{
+ private readonly List<IMappingConfiguration> _configurations = new();
+
+ protected IMappingExpression<TSource, TDest> CreateMap<TSource, TDest>() where TDest : new()
+ {
+ var expr = new MappingExpressionImpl<TSource, TDest>();
+ _configurations.Add(new MappingConfiguration<TSource, TDest>(expr));
+ return expr;
+ }
+
+ internal IEnumerable<IMappingConfiguration> GetConfigurations() => _configurations;
+}
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/AddressProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/AddressProfile.cs
index 47daeddd7..47df0ac81 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/AddressProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/AddressProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Customers;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/BrandProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/BrandProfile.cs
index 7f97ae451..43618f375 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/BrandProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/BrandProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CategoryProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CategoryProfile.cs
index 81134dc3f..bc346eeec 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CategoryProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CollectionProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CollectionProfile.cs
index 52d6c3e9e..73f5ac508 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CollectionProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CollectionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerGroupProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerGroupProfile.cs
index d00fc1ba8..b5bc43bf0 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerGroupProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerGroupProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Customers;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerProfile.cs
index f55ded707..4bad0aef5 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/CustomerProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Customers;
using Grand.Domain.Common;
using Grand.Domain.Customers;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/PictureProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/PictureProfile.cs
index 6a2d98c25..4715e3106 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/PictureProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/PictureProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Common;
using Grand.Domain.Media;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeMappingProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeMappingProfile.cs
index 155d10a92..ddfda7512 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeMappingProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeMappingProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeProfile.cs
index 972fb270a..40bbdee3a 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductProfile.cs
index 3a108eb0b..bd4da4b88 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/ProductProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/SpecificationAttributeProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/SpecificationAttributeProfile.cs
index a667583a1..a9a023292 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/SpecificationAttributeProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/SpecificationAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/TierPriceProfile.cs b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/TierPriceProfile.cs
index 97b96fd01..39df1dd7c 100644
--- a/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/TierPriceProfile.cs
+++ b/src/Modules/Grand.Module.Api/Infrastructure/Mapper/Profiles/TierPriceProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Module.Api.DTOs.Catalog;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Plugins/Shipping.ShippingPoint/MapperConfiguration.cs b/src/Plugins/Shipping.ShippingPoint/MapperConfiguration.cs
index bb454edf8..deb429271 100644
--- a/src/Plugins/Shipping.ShippingPoint/MapperConfiguration.cs
+++ b/src/Plugins/Shipping.ShippingPoint/MapperConfiguration.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Infrastructure.Mapper;
using Shipping.ShippingPoint.Domain;
using Shipping.ShippingPoint.Models;
diff --git a/src/Plugins/Widgets.Slider/Infrastructure/Mapper/SliderMapperConfiguration.cs b/src/Plugins/Widgets.Slider/Infrastructure/Mapper/SliderMapperConfiguration.cs
index 26e914544..f723927da 100644
--- a/src/Plugins/Widgets.Slider/Infrastructure/Mapper/SliderMapperConfiguration.cs
+++ b/src/Plugins/Widgets.Slider/Infrastructure/Mapper/SliderMapperConfiguration.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Infrastructure.Mapper;
using Widgets.Slider.Domain;
using Widgets.Slider.Models;
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs
index bf19ad0ca..ce73aed85 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Catalog.Services.Brands;
using Grand.Business.Catalog.Services.ExportImport;
using Grand.Business.Common.Services.Seo;
@@ -180,7 +180,7 @@ public class BrandImportDataObjectTests
//create AutoMapper configuration
var config = new MapperConfiguration(cfg =>
{
- foreach (var instance in instances) cfg.AddProfile(instance.GetType());
+ foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
});
//register automapper
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs
index 7efa3521c..e83a9ac9a 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Catalog.Services.Categories;
using Grand.Business.Catalog.Services.ExportImport;
using Grand.Business.Common.Services.Security;
@@ -181,7 +181,7 @@ public class CategoryImportDataObjectTests
//create AutoMapper configuration
var config = new MapperConfiguration(cfg =>
{
- foreach (var instance in instances) cfg.AddProfile(instance.GetType());
+ foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
});
//register automapper
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs
index f387c9d7f..17c0d396e 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Catalog.Services.Collections;
using Grand.Business.Catalog.Services.ExportImport;
using Grand.Business.Common.Services.Security;
@@ -185,7 +185,7 @@ public class CollectionImportDataObjectTests
//create AutoMapper configuration
var config = new MapperConfiguration(cfg =>
{
- foreach (var instance in instances) cfg.AddProfile(instance.GetType());
+ foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
});
//register automapper
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs
index 0e4035aaa..469f91791 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Catalog.Services.ExportImport;
using Grand.Business.Catalog.Services.Products;
using Grand.Business.Common.Services.Security;
@@ -279,7 +279,7 @@ public class ProductImportDataObjectTests
//create AutoMapper configuration
var config = new MapperConfiguration(cfg =>
{
- foreach (var instance in instances) cfg.AddProfile(instance.GetType());
+ foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
});
//register automapper
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayoutModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayoutModel_ToDomain.verified.txt
new file mode 100644
index 000000000..fdfdf853c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayoutModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: BrandDefault,
+ ViewPath: BrandTemplate.Simple,
+ DisplayOrder: 2,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayout_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayout_ToModel.verified.txt
new file mode 100644
index 000000000..bd0615d43
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.BrandLayout_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: BrandDefault,
+ ViewPath: BrandTemplate.Simple,
+ DisplayOrder: 2,
+ Id: bl-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayoutModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayoutModel_ToDomain.verified.txt
new file mode 100644
index 000000000..50f26305e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayoutModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: DefaultLayout,
+ ViewPath: CategoryTemplate.Simple,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayout_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayout_ToModel.verified.txt
new file mode 100644
index 000000000..8eb41339d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CategoryLayout_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: DefaultLayout,
+ ViewPath: CategoryTemplate.Simple,
+ DisplayOrder: 1,
+ Id: cl-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayoutModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayoutModel_ToDomain.verified.txt
new file mode 100644
index 000000000..587944822
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayoutModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: CollectionDefault,
+ ViewPath: CollectionTemplate.Simple,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayout_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayout_ToModel.verified.txt
new file mode 100644
index 000000000..f5c891988
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.CollectionLayout_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: CollectionDefault,
+ ViewPath: CollectionTemplate.Simple,
+ DisplayOrder: 1,
+ Id: cll-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayoutModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayoutModel_ToDomain.verified.txt
new file mode 100644
index 000000000..248413138
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayoutModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: PageDefault,
+ ViewPath: PageTemplate.Default,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayout_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayout_ToModel.verified.txt
new file mode 100644
index 000000000..688b11d7a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.PageLayout_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: PageDefault,
+ ViewPath: PageTemplate.Default,
+ DisplayOrder: 1,
+ Id: pgl-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayoutModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayoutModel_ToDomain.verified.txt
new file mode 100644
index 000000000..31c806dac
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayoutModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: SimpleProduct,
+ ViewPath: ProductTemplate.Simple,
+ DisplayOrder: 5,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayout_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayout_ToModel.verified.txt
new file mode 100644
index 000000000..abeb681e2
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.ProductLayout_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: SimpleProduct,
+ ViewPath: ProductTemplate.Simple,
+ DisplayOrder: 5,
+ Id: pl-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.cs
new file mode 100644
index 000000000..638a8bacd
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogLayoutMappingTests.cs
@@ -0,0 +1,108 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Pages;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Layouts;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class CatalogLayoutMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<CategoryLayoutProfile>();
+ cfg.AddProfile<BrandLayoutProfile>();
+ cfg.AddProfile<CollectionLayoutProfile>();
+ cfg.AddProfile<ProductLayoutProfile>();
+ cfg.AddProfile<PageLayoutProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── CategoryLayout ────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CategoryLayout_ToModel()
+ {
+ var source = new CategoryLayout { Id = "cl-001", Name = "DefaultLayout", ViewPath = "CategoryTemplate.Simple", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CategoryLayoutModel>(source));
+ }
+
+ [TestMethod]
+ public Task CategoryLayoutModel_ToDomain()
+ {
+ var model = new CategoryLayoutModel { Name = "DefaultLayout", ViewPath = "CategoryTemplate.Simple", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CategoryLayout>(model));
+ }
+
+ // ── BrandLayout ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BrandLayout_ToModel()
+ {
+ var source = new BrandLayout { Id = "bl-001", Name = "BrandDefault", ViewPath = "BrandTemplate.Simple", DisplayOrder = 2 };
+ return Verify(_mapper.Map<BrandLayoutModel>(source));
+ }
+
+ [TestMethod]
+ public Task BrandLayoutModel_ToDomain()
+ {
+ var model = new BrandLayoutModel { Name = "BrandDefault", ViewPath = "BrandTemplate.Simple", DisplayOrder = 2 };
+ return Verify(_mapper.Map<BrandLayout>(model));
+ }
+
+ // ── CollectionLayout ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CollectionLayout_ToModel()
+ {
+ var source = new CollectionLayout { Id = "cll-001", Name = "CollectionDefault", ViewPath = "CollectionTemplate.Simple", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CollectionLayoutModel>(source));
+ }
+
+ [TestMethod]
+ public Task CollectionLayoutModel_ToDomain()
+ {
+ var model = new CollectionLayoutModel { Name = "CollectionDefault", ViewPath = "CollectionTemplate.Simple", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CollectionLayout>(model));
+ }
+
+ // ── ProductLayout ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductLayout_ToModel()
+ {
+ var source = new ProductLayout { Id = "pl-001", Name = "SimpleProduct", ViewPath = "ProductTemplate.Simple", DisplayOrder = 5 };
+ return Verify(_mapper.Map<ProductLayoutModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductLayoutModel_ToDomain()
+ {
+ var model = new ProductLayoutModel { Name = "SimpleProduct", ViewPath = "ProductTemplate.Simple", DisplayOrder = 5 };
+ return Verify(_mapper.Map<ProductLayout>(model));
+ }
+
+ // ── PageLayout ────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PageLayout_ToModel()
+ {
+ var source = new PageLayout { Id = "pgl-001", Name = "PageDefault", ViewPath = "PageTemplate.Default", DisplayOrder = 1 };
+ return Verify(_mapper.Map<PageLayoutModel>(source));
+ }
+
+ [TestMethod]
+ public Task PageLayoutModel_ToDomain()
+ {
+ var model = new PageLayoutModel { Name = "PageDefault", ViewPath = "PageTemplate.Default", DisplayOrder = 1 };
+ return Verify(_mapper.Map<PageLayout>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.BrandModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.BrandModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c025f8ba9
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.BrandModel_ToDomain.verified.txt
@@ -0,0 +1,30 @@
+{
+ Name: Apple,
+ Description: Apple brand,
+ BottomDescription: Bottom,
+ BrandLayoutId: layout-001,
+ MetaKeywords: apple,
+ MetaDescription: Apple products,
+ MetaTitle: Apple,
+ PictureId: pic-001,
+ PageSize: 20,
+ AllowCustomersToSelectPageSize: false,
+ PageSizeOptions: 20, 40,
+ ShowOnHomePage: true,
+ IncludeInMenu: true,
+ Icon: fa fa-apple,
+ DefaultSort: -1,
+ ExternalId: ext-brand-001,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001,
+ store-002
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Brand_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Brand_ToModel.verified.txt
new file mode 100644
index 000000000..199e43c94
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Brand_ToModel.verified.txt
@@ -0,0 +1,22 @@
+{
+ Name: Apple,
+ Description: Apple brand,
+ BottomDescription: Bottom,
+ BrandLayoutId: layout-001,
+ MetaKeywords: apple,
+ MetaDescription: Apple products,
+ MetaTitle: Apple,
+ SeName: apple,
+ PictureId: pic-001,
+ PageSize: 20,
+ AllowCustomersToSelectPageSize: false,
+ PageSizeOptions: 20, 40,
+ ShowOnHomePage: true,
+ IncludeInMenu: true,
+ Icon: fa fa-apple,
+ DefaultSort: -1,
+ Published: true,
+ DisplayOrder: 1,
+ ExternalId: ext-brand-001,
+ Id: brand-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CategoryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CategoryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..0244f4308
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CategoryModel_ToDomain.verified.txt
@@ -0,0 +1,36 @@
+{
+ Name: Electronics,
+ Description: Electronic products,
+ BottomDescription: More electronics,
+ CategoryLayoutId: layout-001,
+ MetaKeywords: electronics, gadgets,
+ MetaDescription: Shop electronics online,
+ MetaTitle: Electronics,
+ ParentCategoryId: parent-001,
+ PictureId: pic-001,
+ PageSize: 15,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 15, 30, 60,
+ ShowOnHomePage: true,
+ FeaturedProductsOnHomePage: false,
+ ShowOnSearchBox: true,
+ SearchBoxDisplayOrder: 2,
+ IncludeInMenu: true,
+ Published: true,
+ DisplayOrder: 5,
+ ExternalId: ext-001,
+ Flag: New,
+ FlagStyle: bg-success,
+ Icon: fa fa-laptop,
+ HideOnCatalog: false,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001,
+ grp-002
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Category_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Category_ToModel.verified.txt
new file mode 100644
index 000000000..9283c92e5
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Category_ToModel.verified.txt
@@ -0,0 +1,28 @@
+{
+ Name: Electronics,
+ Description: Electronic products,
+ BottomDescription: More electronics,
+ CategoryLayoutId: layout-001,
+ MetaKeywords: electronics, gadgets,
+ MetaDescription: Shop electronics online,
+ MetaTitle: Electronics,
+ SeName: electronics,
+ ParentCategoryId: parent-001,
+ PictureId: pic-001,
+ PageSize: 15,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 15, 30, 60,
+ ShowOnHomePage: true,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: true,
+ Published: true,
+ DisplayOrder: 5,
+ ExternalId: ext-001,
+ Flag: New,
+ FlagStyle: bg-success,
+ Icon: fa fa-laptop,
+ HideOnCatalog: false,
+ ShowOnSearchBox: true,
+ SearchBoxDisplayOrder: 2,
+ Id: cat-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CollectionModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CollectionModel_ToDomain.verified.txt
new file mode 100644
index 000000000..fd1136589
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.CollectionModel_ToDomain.verified.txt
@@ -0,0 +1,18 @@
+{
+ Name: Summer Sale,
+ Description: Summer collection,
+ CollectionLayoutId: layout-002,
+ PageSize: 5,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ Published: true,
+ DisplayOrder: 3,
+ LimitedToGroups: false,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Collection_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Collection_ToModel.verified.txt
new file mode 100644
index 000000000..12f4e8dcb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Collection_ToModel.verified.txt
@@ -0,0 +1,22 @@
+{
+ Name: Summer Sale,
+ Description: Summer collection,
+ BottomDescription: End of summer,
+ CollectionLayoutId: layout-002,
+ MetaKeywords: summer, sale,
+ MetaDescription: Summer sales,
+ MetaTitle: Summer Collection,
+ SeName: summer-sale,
+ PictureId: pic-002,
+ PageSize: 10,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 10, 20,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ DefaultSort: -1,
+ Published: true,
+ DisplayOrder: 3,
+ ExternalId: ext-col-001,
+ Id: col-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDateModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDateModel_ToDomain.verified.txt
new file mode 100644
index 000000000..a44118b17
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDateModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: 2-3 Business Days,
+ DisplayOrder: 1,
+ ColorSquaresRgb: #00FF00,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDate_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDate_ToModel.verified.txt
new file mode 100644
index 000000000..4751e7f6c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DeliveryDate_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: 2-3 Business Days,
+ DisplayOrder: 1,
+ ColorSquaresRgb: #00FF00,
+ Id: dd-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DiscountModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DiscountModel_ToDomain.verified.txt
new file mode 100644
index 000000000..230194450
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.DiscountModel_ToDomain.verified.txt
@@ -0,0 +1,19 @@
+{
+ Name: 10% Off,
+ DiscountTypeId: AssignedToOrderTotal,
+ UsePercentage: true,
+ DiscountPercentage: 10.0,
+ CalculateByPlugin: false,
+ MaximumDiscountAmount: 0.0,
+ RequiresCouponCode: true,
+ Reused: false,
+ IsCumulative: false,
+ MaximumDiscountedQuantity: 0,
+ IsEnabled: true,
+ LimitedToStores: true,
+ Stores: [
+ store-001,
+ store-002
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel.verified.txt
new file mode 100644
index 000000000..26f0ecace
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel.verified.txt
@@ -0,0 +1,19 @@
+{
+ Name: 10% Off,
+ DiscountTypeId: 1,
+ UsePercentage: true,
+ DiscountPercentage: 10.0,
+ CurrencyCode: USD,
+ CalculateByPlugin: false,
+ MaximumDiscountAmount: 100.0,
+ RequiresCouponCode: true,
+ Reused: false,
+ IsCumulative: false,
+ LimitationTimes: 100,
+ MaximumDiscountedQuantity: 5,
+ IsEnabled: true,
+ Stores: [
+ store-001
+ ],
+ Id: disc-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFieldsAreNull.verified.txt.bak b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFieldsAreNull.verified.txt.bak
new file mode 100644
index 000000000..cfe089dd0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFieldsAreNull.verified.txt.bak
@@ -0,0 +1,11 @@
+{
+ Name: No Dates Discount,
+ DiscountTypeId: 1,
+ UsePercentage: false,
+ CalculateByPlugin: false,
+ RequiresCouponCode: false,
+ Reused: false,
+ IsCumulative: false,
+ IsEnabled: true,
+ Id: disc-002
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithNull.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithNull.verified.txt
new file mode 100644
index 000000000..f3d3f8d29
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithNull.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: No Dates Discount,
+ DiscountTypeId: 1,
+ UsePercentage: false,
+ CalculateByPlugin: false,
+ RequiresCouponCode: false,
+ Reused: false,
+ IsCumulative: false,
+ IsEnabled: true,
+ Id: disc-003
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithValues.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithValues.verified.txt
new file mode 100644
index 000000000..fc9aae9e7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.Discount_ToModel_NullableFields_WithValues.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: Summer Sale,
+ DiscountTypeId: 1,
+ UsePercentage: false,
+ CalculateByPlugin: false,
+ MaximumDiscountAmount: 50.0,
+ RequiresCouponCode: false,
+ Reused: false,
+ IsCumulative: false,
+ IsEnabled: true,
+ Id: disc-002
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.GiftVoucher_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.GiftVoucher_ToModel.verified.txt
new file mode 100644
index 000000000..86d4228db
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.GiftVoucher_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ Amount: 50.0,
+ CurrencyCode: USD,
+ IsGiftVoucherActivated: true,
+ Code: GIFT50,
+ RecipientName: John Doe,
+ RecipientEmail: [email protected],
+ SenderName: Jane,
+ SenderEmail: [email protected],
+ Message: Happy Birthday!,
+ IsRecipientNotified: false,
+ Id: gv-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.cs
new file mode 100644
index 000000000..f5c79642c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogMappingTests.cs
@@ -0,0 +1,344 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Discounts;
+using Grand.Domain.Orders;
+using Grand.Domain.Shipping;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Catalog;
+using Grand.Web.AdminShared.Models.Discounts;
+using Grand.Web.AdminShared.Models.Orders;
+using Grand.Web.AdminShared.Models.Shipping;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class CatalogMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<CategoryProfile>();
+ cfg.AddProfile<BrandProfile>();
+ cfg.AddProfile<CollectionProfile>();
+ cfg.AddProfile<DeliveryDateProfile>();
+ cfg.AddProfile<DiscountProfile>();
+ cfg.AddProfile<GiftVoucherProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Category ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Category_ToModel()
+ {
+ var source = new Category {
+ Id = "cat-001",
+ Name = "Electronics",
+ Description = "Electronic products",
+ BottomDescription = "More electronics",
+ CategoryLayoutId = "layout-001",
+ MetaKeywords = "electronics, gadgets",
+ MetaDescription = "Shop electronics online",
+ MetaTitle = "Electronics",
+ ParentCategoryId = "parent-001",
+ PictureId = "pic-001",
+ PageSize = 15,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "15, 30, 60",
+ ShowOnHomePage = true,
+ FeaturedProductsOnHomePage = false,
+ ShowOnSearchBox = true,
+ SearchBoxDisplayOrder = 2,
+ IncludeInMenu = true,
+ Published = true,
+ DisplayOrder = 5,
+ ExternalId = "ext-001",
+ Flag = "New",
+ FlagStyle = "bg-success",
+ Icon = "fa fa-laptop",
+ HideOnCatalog = false,
+ DefaultSort = 0,
+ SeName = "electronics"
+ };
+ var result = _mapper.Map<CategoryModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task CategoryModel_ToDomain()
+ {
+ var model = new CategoryModel {
+ Id = "cat-001",
+ Name = "Electronics",
+ Description = "Electronic products",
+ BottomDescription = "More electronics",
+ CategoryLayoutId = "layout-001",
+ MetaKeywords = "electronics, gadgets",
+ MetaDescription = "Shop electronics online",
+ MetaTitle = "Electronics",
+ ParentCategoryId = "parent-001",
+ PictureId = "pic-001",
+ PageSize = 15,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "15, 30, 60",
+ ShowOnHomePage = true,
+ FeaturedProductsOnHomePage = false,
+ ShowOnSearchBox = true,
+ SearchBoxDisplayOrder = 2,
+ IncludeInMenu = true,
+ Published = true,
+ DisplayOrder = 5,
+ ExternalId = "ext-001",
+ Flag = "New",
+ FlagStyle = "bg-success",
+ Icon = "fa fa-laptop",
+ HideOnCatalog = false,
+ DefaultSort = 0,
+ CustomerGroups = ["grp-001", "grp-002"],
+ Stores = ["store-001"]
+ };
+ var result = _mapper.Map<Category>(model);
+ return Verify(result);
+ }
+
+ // ── Brand ─────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Brand_ToModel()
+ {
+ var source = new Brand {
+ Id = "brand-001",
+ Name = "Apple",
+ Description = "Apple brand",
+ BottomDescription = "Bottom",
+ BrandLayoutId = "layout-001",
+ MetaKeywords = "apple",
+ MetaDescription = "Apple products",
+ MetaTitle = "Apple",
+ PictureId = "pic-001",
+ PageSize = 20,
+ AllowCustomersToSelectPageSize = false,
+ PageSizeOptions = "20, 40",
+ ShowOnHomePage = true,
+ IncludeInMenu = true,
+ Icon = "fa fa-apple",
+ DefaultSort = -1,
+ Published = true,
+ DisplayOrder = 1,
+ ExternalId = "ext-brand-001",
+ SeName = "apple"
+ };
+ var result = _mapper.Map<BrandModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task BrandModel_ToDomain()
+ {
+ var model = new BrandModel {
+ Id = "brand-001",
+ Name = "Apple",
+ Description = "Apple brand",
+ BottomDescription = "Bottom",
+ BrandLayoutId = "layout-001",
+ MetaKeywords = "apple",
+ MetaDescription = "Apple products",
+ MetaTitle = "Apple",
+ PictureId = "pic-001",
+ PageSize = 20,
+ AllowCustomersToSelectPageSize = false,
+ PageSizeOptions = "20, 40",
+ ShowOnHomePage = true,
+ IncludeInMenu = true,
+ Icon = "fa fa-apple",
+ DefaultSort = -1,
+ Published = true,
+ DisplayOrder = 1,
+ ExternalId = "ext-brand-001",
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001", "store-002"]
+ };
+ var result = _mapper.Map<Brand>(model);
+ return Verify(result);
+ }
+
+ // ── Collection ────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Collection_ToModel()
+ {
+ var source = new Collection {
+ Id = "col-001",
+ Name = "Summer Sale",
+ Description = "Summer collection",
+ BottomDescription = "End of summer",
+ CollectionLayoutId = "layout-002",
+ MetaKeywords = "summer, sale",
+ MetaDescription = "Summer sales",
+ MetaTitle = "Summer Collection",
+ PictureId = "pic-002",
+ PageSize = 10,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "10, 20",
+ ShowOnHomePage = false,
+ IncludeInMenu = false,
+ Published = true,
+ DisplayOrder = 3,
+ ExternalId = "ext-col-001",
+ SeName = "summer-sale"
+ };
+ var result = _mapper.Map<CollectionModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task CollectionModel_ToDomain()
+ {
+ var model = new CollectionModel {
+ Id = "col-001",
+ Name = "Summer Sale",
+ Description = "Summer collection",
+ CollectionLayoutId = "layout-002",
+ Published = true,
+ DisplayOrder = 3,
+ Stores = ["store-001"]
+ };
+ var result = _mapper.Map<Collection>(model);
+ return Verify(result);
+ }
+
+ // ── DeliveryDate ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task DeliveryDate_ToModel()
+ {
+ var source = new DeliveryDate {
+ Id = "dd-001",
+ Name = "2-3 Business Days",
+ DisplayOrder = 1,
+ ColorSquaresRgb = "#00FF00"
+ };
+ var result = _mapper.Map<DeliveryDateModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task DeliveryDateModel_ToDomain()
+ {
+ var model = new DeliveryDateModel {
+ Name = "2-3 Business Days",
+ DisplayOrder = 1,
+ ColorSquaresRgb = "#00FF00"
+ };
+ var result = _mapper.Map<DeliveryDate>(model);
+ return Verify(result);
+ }
+
+ // ── Discount ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Discount_ToModel()
+ {
+ var source = new Discount {
+ Id = "disc-001",
+ Name = "10% Off",
+ DiscountTypeId = (DiscountType)1,
+ UsePercentage = true,
+ DiscountPercentage = 10,
+ DiscountAmount = 0,
+ MaximumDiscountAmount = 100,
+ StartDateUtc = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc),
+ EndDateUtc = new DateTime(2024, 12, 31, 0, 0, 0, DateTimeKind.Utc),
+ RequiresCouponCode = true,
+ IsEnabled = true,
+ LimitationTimes = 100,
+ MaximumDiscountedQuantity = 5,
+ CurrencyCode = "USD",
+ Stores = ["store-001"]
+ };
+ var result = _mapper.Map<DiscountModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task Discount_ToModel_NullableFields_WithValues()
+ {
+ var source = new Discount {
+ Id = "disc-002",
+ Name = "Summer Sale",
+ DiscountTypeId = (DiscountType)1,
+ MaximumDiscountAmount = 50.0,
+ StartDateUtc = new DateTime(2024, 6, 1, 0, 0, 0, DateTimeKind.Utc),
+ EndDateUtc = new DateTime(2024, 8, 31, 23, 59, 59, DateTimeKind.Utc),
+ IsEnabled = true
+ };
+ var result = _mapper.Map<DiscountModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task Discount_ToModel_NullableFields_WithNull()
+ {
+ // Regression: Nullable<T> → T coercion threw InvalidOperationException
+ // when the source nullable was null (e.g. MaximumDiscountAmount, StartDateUtc).
+ var source = new Discount {
+ Id = "disc-003",
+ Name = "No Dates Discount",
+ DiscountTypeId = (DiscountType)1,
+ // MaximumDiscountAmount = null (double?)
+ // StartDateUtc = null (DateTime?)
+ // EndDateUtc = null (DateTime?)
+ IsEnabled = true
+ };
+ var result = _mapper.Map<DiscountModel>(source);
+ return Verify(result);
+ }
+
+ [TestMethod]
+ public Task DiscountModel_ToDomain()
+ {
+ var model = new DiscountModel {
+ Id = "disc-001",
+ Name = "10% Off",
+ DiscountTypeId = 1,
+ UsePercentage = true,
+ DiscountPercentage = 10,
+ DiscountAmount = 0,
+ RequiresCouponCode = true,
+ IsEnabled = true,
+ Stores = ["store-001", "store-002"]
+ };
+ var result = _mapper.Map<Discount>(model);
+ return Verify(result);
+ }
+
+ // ── GiftVoucher ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task GiftVoucher_ToModel()
+ {
+ var source = new GiftVoucher {
+ Id = "gv-001",
+ GiftVoucherTypeId = 0,
+ Amount = 50.00,
+ IsGiftVoucherActivated = true,
+ Code = "GIFT50",
+ RecipientName = "John Doe",
+ RecipientEmail = "[email protected]",
+ SenderName = "Jane",
+ SenderEmail = "[email protected]",
+ Message = "Happy Birthday!",
+ IsRecipientNotified = false,
+ CreatedOnUtc = new DateTime(2024, 6, 1, 10, 0, 0, DateTimeKind.Utc),
+ CurrencyCode = "USD"
+ };
+ var result = _mapper.Map<GiftVoucherModel>(source);
+ return Verify(result);
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValueModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValueModel_ToDomain.verified.txt
new file mode 100644
index 000000000..bff6bdc2d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValueModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ Name: Red,
+ PriceAdjustment: 5.0,
+ WeightAdjustment: 0.1,
+ Cost: 1.5,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToModel.verified.txt
new file mode 100644
index 000000000..b1b257b32
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: Red,
+ PriceAdjustment: 5.0,
+ PriceAdjustmentStr: 5.00,
+ WeightAdjustment: 0.1,
+ WeightAdjustmentStr: 0.10,
+ Cost: 1.5,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: ppav-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToProductAttributeValue.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToProductAttributeValue.verified.txt
new file mode 100644
index 000000000..dd52bf8f8
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.PredefinedAttributeValue_ToProductAttributeValue.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Blue,
+ PriceAdjustment: 3.0,
+ Cost: 1.0,
+ IsPreSelected: false,
+ DisplayOrder: 2,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombinationModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombinationModel_ToDomain.verified.txt
new file mode 100644
index 000000000..63c526d18
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombinationModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ StockQuantity: 10,
+ AllowOutOfStockOrders: false,
+ Sku: SKU-RED-M,
+ Gtin: 1234567890,
+ OverriddenPrice: 95.0,
+ NotifyAdminForQuantityBelow: 2,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombination_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombination_ToModel.verified.txt
new file mode 100644
index 000000000..89b41ac76
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeCombination_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ Id: pac-001,
+ StockQuantity: 10,
+ AllowOutOfStockOrders: false,
+ Sku: SKU-RED-M,
+ Gtin: 1234567890,
+ OverriddenPrice: 95.0,
+ NotifyAdminForQuantityBelow: 2,
+ UseMultipleWarehouses: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMappingModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMappingModel_ToDomain.verified.txt
new file mode 100644
index 000000000..a8c8ebe5d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMappingModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ ProductAttributeId: pa-001,
+ TextPrompt: Choose color,
+ IsRequired: true,
+ ShowOnCatalogPage: false,
+ Combination: false,
+ AttributeControlTypeId: DropdownList,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMapping_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMapping_ToModel.verified.txt
new file mode 100644
index 000000000..1a7d15d0e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeMapping_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ ProductAttributeId: pa-001,
+ TextPrompt: Choose color,
+ IsRequired: true,
+ ShowOnCatalogPage: false,
+ AttributeControlTypeId: DropdownList,
+ DisplayOrder: 1,
+ Combination: false,
+ ShouldHaveValues: false,
+ ValidationRulesAllowed: false,
+ ConditionAllowed: false,
+ Id: pam-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..92ddee524
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ Name: Color,
+ Description: Product color,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..4be5efdaf
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductAttribute_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Color,
+ Description: Product color,
+ Id: pa-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c7924c187
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain.verified.txt
@@ -0,0 +1,51 @@
+{
+ VisibleIndividually: true,
+ Name: Laptop Pro,
+ ShortDescription: High-performance laptop,
+ FullDescription: Full description,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: LAPTOP-001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 50,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 999.99,
+ OldPrice: 1199.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ Weight: 2.5,
+ Length: 35.0,
+ Width: 24.0,
+ Height: 2.0,
+ AuctionEnded: false,
+ DisplayOrder: 1,
+ Published: true,
+ LimitedToGroups: false,
+ SeName: laptop-pro,
+ LimitedToStores: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain_WithCalendarData.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain_WithCalendarData.verified.txt
new file mode 100644
index 000000000..a9cb2d40d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductModel_ToDomain_WithCalendarData.verified.txt
@@ -0,0 +1,40 @@
+{
+ VisibleIndividually: false,
+ Name: Calendar Product,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: CAL-001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: true,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: false,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductReviewModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductReviewModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8ddeffef3
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductReviewModel_ToDomain.verified.txt
@@ -0,0 +1,11 @@
+{
+ CustomerId: cust-001,
+ ProductId: prod-001,
+ IsApproved: true,
+ Title: Great product,
+ ReviewText: Really impressed!,
+ ReplyText: Thank you!,
+ ConfirmedPurchase: false,
+ Rating: 5,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecificationModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecificationModel_ToDomain.verified.txt
new file mode 100644
index 000000000..1d78cb2ed
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecificationModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ AttributeTypeId: 1,
+ SpecificationAttributeId: sa-001,
+ SpecificationAttributeOptionId: sao-001,
+ CustomValue: Custom,
+ AllowFiltering: true,
+ ShowOnProductPage: true,
+ DisplayOrder: 2,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecification_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecification_ToModel.verified.txt
new file mode 100644
index 000000000..7b38f931e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.ProductSpecification_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ Id: psa-001,
+ SpecificationAttributeId: sa-001,
+ AttributeTypeId: 1,
+ SpecificationAttributeOptionId: sao-001,
+ CustomValue: Custom,
+ AllowFiltering: true,
+ ShowOnProductPage: true,
+ DisplayOrder: 2
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel.verified.txt
new file mode 100644
index 000000000..c57b50cc9
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel.verified.txt
@@ -0,0 +1,76 @@
+{
+ Id: prod-001,
+ AuctionEnded: false,
+ VisibleIndividually: true,
+ ProductLayoutId: pl-001,
+ Name: Laptop Pro,
+ ShortDescription: High-performance laptop,
+ FullDescription: A full description of the laptop,
+ AdminComment: Internal note,
+ BrandId: brand-001,
+ VendorId: vendor-001,
+ ShowOnHomePage: true,
+ BestSeller: false,
+ MetaKeywords: laptop,
+ MetaDescription: Buy laptop,
+ MetaTitle: Laptop,
+ SeName: laptop-pro,
+ AllowCustomerReviews: true,
+ Sku: LAPTOP-001,
+ Gtin: 1234567890,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ CalendarModel: {
+ Interval: 1,
+ IncBothDate: false,
+ Quantity: 1,
+ Monday: false,
+ Tuesday: false,
+ Wednesday: false,
+ Thursday: false,
+ Friday: false,
+ Saturday: false,
+ Sunday: false
+ },
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ ManageInventoryMethodId: 1,
+ UseMultipleWarehouses: false,
+ StockQuantity: 50,
+ StockAvailability: false,
+ DisplayStockQuantity: true,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 999.99,
+ OldPrice: 1199.99,
+ ProductCost: 600.0,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ Weight: 2.5,
+ Length: 35.0,
+ Width: 24.0,
+ Height: 2.0,
+ DisplayOrder: 1,
+ Published: true,
+ AddPictureModel: {
+ IsDefault: false
+ },
+ CopyProductModel: {
+ CopyImages: false,
+ Published: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel_WithCalendarData.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel_WithCalendarData.verified.txt
new file mode 100644
index 000000000..7cd17a864
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.Product_ToModel_WithCalendarData.verified.txt
@@ -0,0 +1,55 @@
+{
+ Id: prod-002,
+ AuctionEnded: false,
+ VisibleIndividually: false,
+ Name: Calendar Product,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: CAL-001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ CalendarModel: {
+ Interval: 1,
+ IncBothDate: true,
+ Quantity: 1,
+ Monday: false,
+ Tuesday: false,
+ Wednesday: false,
+ Thursday: false,
+ Friday: false,
+ Saturday: false,
+ Sunday: false
+ },
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ Published: false,
+ AddPictureModel: {
+ IsDefault: false
+ },
+ CopyProductModel: {
+ CopyImages: false,
+ Published: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..25686e374
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ Name: Screen Size,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOptionModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOptionModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5bed76332
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOptionModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: 15 inch,
+ ColorSquaresRgb: #FFFFFF,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOption_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOption_ToModel.verified.txt
new file mode 100644
index 000000000..46d52833e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttributeOption_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: 15 inch,
+ SeName: 15-inch,
+ ColorSquaresRgb: #FFFFFF,
+ EnableColorSquaresRgb: false,
+ DisplayOrder: 1,
+ Id: sao-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..8abbb8e88
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.SpecificationAttribute_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Screen Size,
+ SeName: screen-size,
+ DisplayOrder: 1,
+ Id: sattr-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPriceModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPriceModel_ToDomain.verified.txt
new file mode 100644
index 000000000..123f9ea59
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPriceModel_ToDomain.verified.txt
@@ -0,0 +1,8 @@
+{
+ StoreId: store-001,
+ CustomerGroupId: grp-001,
+ CurrencyCode: USD,
+ Quantity: 10,
+ Price: 89.99,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPrice_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPrice_ToModel.verified.txt
new file mode 100644
index 000000000..4cfdfb247
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.TierPrice_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ CustomerGroupId: grp-001,
+ StoreId: store-001,
+ CurrencyCode: USD,
+ Quantity: 10,
+ Price: 89.99,
+ Id: tp-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.cs
new file mode 100644
index 000000000..74aa98c2d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CatalogProductMappingTests.cs
@@ -0,0 +1,382 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Catalog;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class CatalogProductMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<ProductProfile>();
+ cfg.AddProfile<TierPriceProfile>();
+ cfg.AddProfile<ProductSpecificationProfile>();
+ cfg.AddProfile<ProductAttributeProfile>();
+ cfg.AddProfile<PredefinedProductAttributeValueProfile>();
+ cfg.AddProfile<ProductAttributeMappingProfile>();
+ cfg.AddProfile<ProductAttributeCombinationProfile>();
+ cfg.AddProfile<ProductReviewProfile>();
+ cfg.AddProfile<SpecificationAttributeProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Product ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Product_ToModel()
+ {
+ var source = new Product {
+ Id = "prod-001",
+ Name = "Laptop Pro",
+ ShortDescription = "High-performance laptop",
+ FullDescription = "A full description of the laptop",
+ AdminComment = "Internal note",
+ ProductLayoutId = "pl-001",
+ BrandId = "brand-001",
+ VendorId = "vendor-001",
+ ShowOnHomePage = true,
+ MetaKeywords = "laptop",
+ MetaDescription = "Buy laptop",
+ MetaTitle = "Laptop",
+ AllowCustomerReviews = true,
+ Published = true,
+ VisibleIndividually = true,
+ Price = 999.99,
+ OldPrice = 1199.99,
+ ProductCost = 600,
+ MarkAsNew = false,
+ Weight = 2.5,
+ Length = 35,
+ Width = 24,
+ Height = 2,
+ DisplayOrder = 1,
+ DisplayStockQuantity = true,
+ ManageInventoryMethodId = (ManageInventoryMethod)1,
+ StockQuantity = 50,
+ Sku = "LAPTOP-001",
+ Gtin = "1234567890",
+ SeName = "laptop-pro"
+ };
+ return Verify(_mapper.Map<ProductModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductModel_ToDomain()
+ {
+ var model = new ProductModel {
+ Id = "prod-001",
+ Name = "Laptop Pro",
+ ShortDescription = "High-performance laptop",
+ FullDescription = "Full description",
+ Published = true,
+ VisibleIndividually = true,
+ Price = 999.99,
+ OldPrice = 1199.99,
+ Sku = "LAPTOP-001",
+ Weight = 2.5,
+ Length = 35,
+ Width = 24,
+ Height = 2,
+ StockQuantity = 50,
+ DisplayOrder = 1,
+ SeName = "laptop-pro"
+ };
+ return Verify(_mapper.Map<Product>(model));
+ }
+
+ [TestMethod]
+ public Task Product_ToModel_WithCalendarData()
+ {
+ var source = new Product {
+ Id = "prod-002",
+ Name = "Calendar Product",
+ Sku = "CAL-001",
+ IncBothDate = true
+ };
+ return Verify(_mapper.Map<ProductModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductModel_ToDomain_WithCalendarData()
+ {
+ var model = new ProductModel {
+ Name = "Calendar Product",
+ Sku = "CAL-001",
+ CalendarModel = new ProductModel.GenerateCalendarModel {
+ IncBothDate = true
+ }
+ };
+ return Verify(_mapper.Map<Product>(model));
+ }
+
+ // ── TierPrice ─────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task TierPrice_ToModel()
+ {
+ var source = new TierPrice {
+ Id = "tp-001",
+ StoreId = "store-001",
+ CustomerGroupId = "grp-001",
+ Quantity = 10,
+ Price = 89.99,
+ StartDateTimeUtc = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc),
+ EndDateTimeUtc = new DateTime(2024, 12, 31, 0, 0, 0, DateTimeKind.Utc),
+ CurrencyCode = "USD"
+ };
+ return Verify(_mapper.Map<ProductModel.TierPriceModel>(source));
+ }
+
+ [TestMethod]
+ public Task TierPriceModel_ToDomain()
+ {
+ var model = new ProductModel.TierPriceModel {
+ StoreId = "store-001",
+ CustomerGroupId = "grp-001",
+ Quantity = 10,
+ Price = 89.99,
+ CurrencyCode = "USD"
+ };
+ return Verify(_mapper.Map<TierPrice>(model));
+ }
+
+ // ── ProductSpecificationAttribute ─────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductSpecification_ToModel()
+ {
+ var source = new ProductSpecificationAttribute {
+ Id = "psa-001",
+ AttributeTypeId = (SpecificationAttributeType)1,
+ SpecificationAttributeId = "sa-001",
+ SpecificationAttributeOptionId = "sao-001",
+ CustomValue = "Custom",
+ AllowFiltering = true,
+ ShowOnProductPage = true,
+ DisplayOrder = 2
+ };
+ return Verify(_mapper.Map<ProductModel.AddProductSpecificationAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductSpecificationModel_ToDomain()
+ {
+ var model = new ProductModel.AddProductSpecificationAttributeModel {
+ AttributeTypeId = (SpecificationAttributeType)1,
+ SpecificationAttributeId = "sa-001",
+ SpecificationAttributeOptionId = "sao-001",
+ CustomValue = "Custom",
+ AllowFiltering = true,
+ ShowOnProductPage = true,
+ DisplayOrder = 2
+ };
+ return Verify(_mapper.Map<ProductSpecificationAttribute>(model));
+ }
+
+ // ── ProductAttribute ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttribute_ToModel()
+ {
+ var source = new ProductAttribute {
+ Id = "pa-001",
+ Name = "Color",
+ Description = "Product color"
+ };
+ return Verify(_mapper.Map<ProductAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductAttributeModel_ToDomain()
+ {
+ var model = new ProductAttributeModel {
+ Name = "Color",
+ Description = "Product color",
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<ProductAttribute>(model));
+ }
+
+ // ── PredefinedProductAttributeValue ───────────────────────────────────────
+
+ [TestMethod]
+ public Task PredefinedAttributeValue_ToModel()
+ {
+ var source = new PredefinedProductAttributeValue {
+ Id = "ppav-001",
+ Name = "Red",
+ PriceAdjustment = 5.00,
+ WeightAdjustment = 0.1,
+ Cost = 1.5,
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<PredefinedProductAttributeValueModel>(source));
+ }
+
+ [TestMethod]
+ public Task PredefinedAttributeValueModel_ToDomain()
+ {
+ var model = new PredefinedProductAttributeValueModel {
+ Name = "Red",
+ PriceAdjustment = 5.00,
+ WeightAdjustment = 0.1,
+ Cost = 1.5,
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<PredefinedProductAttributeValue>(model));
+ }
+
+ // ── ProductAttributeMapping ───────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeMapping_ToModel()
+ {
+ var source = new ProductAttributeMapping {
+ Id = "pam-001",
+ ProductAttributeId = "pa-001",
+ TextPrompt = "Choose color",
+ IsRequired = true,
+ AttributeControlTypeId = (AttributeControlType)1,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ProductModel.ProductAttributeMappingModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductAttributeMappingModel_ToDomain()
+ {
+ var model = new ProductModel.ProductAttributeMappingModel {
+ ProductAttributeId = "pa-001",
+ TextPrompt = "Choose color",
+ IsRequired = true,
+ AttributeControlTypeId = (AttributeControlType)1,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ProductAttributeMapping>(model));
+ }
+
+ // ── ProductAttributeCombination ───────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeCombination_ToModel()
+ {
+ var source = new ProductAttributeCombination {
+ Id = "pac-001",
+ Sku = "SKU-RED-M",
+ Gtin = "1234567890",
+ AllowOutOfStockOrders = false,
+ StockQuantity = 10,
+ OverriddenPrice = 95.00,
+ NotifyAdminForQuantityBelow = 2
+ };
+ return Verify(_mapper.Map<ProductAttributeCombinationModel>(source));
+ }
+
+ [TestMethod]
+ public Task ProductAttributeCombinationModel_ToDomain()
+ {
+ var model = new ProductAttributeCombinationModel {
+ Sku = "SKU-RED-M",
+ Gtin = "1234567890",
+ AllowOutOfStockOrders = false,
+ StockQuantity = 10,
+ OverriddenPrice = 95.00,
+ NotifyAdminForQuantityBelow = 2
+ };
+ return Verify(_mapper.Map<ProductAttributeCombination>(model));
+ }
+
+ // ── PredefinedAttributeValue → ProductAttributeValue ─────────────────────
+
+ [TestMethod]
+ public Task PredefinedAttributeValue_ToProductAttributeValue()
+ {
+ var source = new PredefinedProductAttributeValue {
+ Id = "ppav-001",
+ Name = "Blue",
+ PriceAdjustment = 3.00,
+ WeightAdjustment = 0,
+ Cost = 1.0,
+ IsPreSelected = false,
+ DisplayOrder = 2
+ };
+ return Verify(_mapper.Map<ProductAttributeValue>(source));
+ }
+
+ // ── ProductReview (model → domain) ────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductReviewModel_ToDomain()
+ {
+ var model = new ProductReviewModel {
+ CustomerId = "cust-001",
+ ProductId = "prod-001",
+ IsApproved = true,
+ Title = "Great product",
+ ReviewText = "Really impressed!",
+ ReplyText = "Thank you!",
+ Rating = 5
+ };
+ return Verify(_mapper.Map<ProductReview>(model));
+ }
+
+ // ── SpecificationAttribute ────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task SpecificationAttribute_ToModel()
+ {
+ var source = new SpecificationAttribute {
+ Id = "sattr-001",
+ Name = "Screen Size",
+ DisplayOrder = 1,
+ SeName = "screen-size"
+ };
+ return Verify(_mapper.Map<SpecificationAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task SpecificationAttributeModel_ToDomain()
+ {
+ var model = new SpecificationAttributeModel {
+ Name = "Screen Size",
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<SpecificationAttribute>(model));
+ }
+
+ [TestMethod]
+ public Task SpecificationAttributeOption_ToModel()
+ {
+ var source = new SpecificationAttributeOption {
+ Id = "sao-001",
+ Name = "15 inch",
+ DisplayOrder = 1,
+ ColorSquaresRgb = "#FFFFFF",
+ SeName = "15-inch"
+ };
+ return Verify(_mapper.Map<SpecificationAttributeOptionModel>(source));
+ }
+
+ [TestMethod]
+ public Task SpecificationAttributeOptionModel_ToDomain()
+ {
+ var model = new SpecificationAttributeOptionModel {
+ Name = "15 inch",
+ DisplayOrder = 1,
+ ColorSquaresRgb = "#FFFFFF"
+ };
+ return Verify(_mapper.Map<SpecificationAttributeOption>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..146d5dde0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Custom Field,
+ IsRequired: true,
+ AttributeControlTypeId: 1,
+ DisplayOrder: 1,
+ AttributeControlType: DropdownList,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValueModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValueModel_ToDomain.verified.txt
new file mode 100644
index 000000000..cbd60ef10
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValueModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Option A,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValue_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValue_ToModel.verified.txt
new file mode 100644
index 000000000..92d369196
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttributeValue_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Option A,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: aav-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..23f3a0fe5
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressAttribute_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Custom Field,
+ IsRequired: true,
+ AttributeControlTypeId: 1,
+ DisplayOrder: 1,
+ Id: aa-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressModel_ToDomain.verified.txt
new file mode 100644
index 000000000..9aa6044f1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.AddressModel_ToDomain.verified.txt
@@ -0,0 +1,14 @@
+{
+ FirstName: John,
+ LastName: Doe,
+ Company: ACME Corp,
+ CountryId: country-001,
+ StateProvinceId: state-001,
+ City: New York,
+ Address1: 123 Main St,
+ Address2: Apt 4B,
+ ZipPostalCode: 10001,
+ PhoneNumber: +1-555-1234,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Address_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Address_ToModel.verified.txt
new file mode 100644
index 000000000..db06a72f7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Address_ToModel.verified.txt
@@ -0,0 +1,42 @@
+{
+ FirstName: John,
+ LastName: Doe,
+ Company: ACME Corp,
+ CountryId: country-001,
+ StateProvinceId: state-001,
+ City: New York,
+ Address1: 123 Main St,
+ Address2: Apt 4B,
+ ZipPostalCode: 10001,
+ PhoneNumber: +1-555-1234,
+ FaxNumber: +1-555-5678,
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ Id: addr-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.BankAccount_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.BankAccount_ToModel.verified.txt
new file mode 100644
index 000000000..08e60d0ec
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.BankAccount_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ BankCode: CHASE123,
+ BankName: Chase,
+ SwiftCode: CHASUS33,
+ AccountNumber: 123456789,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CountryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CountryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..3c24f30ce
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CountryModel_ToDomain.verified.txt
@@ -0,0 +1,16 @@
+{
+ Name: United States,
+ AllowsBilling: true,
+ AllowsShipping: true,
+ TwoLetterIsoCode: US,
+ ThreeLetterIsoCode: USA,
+ NumericIsoCode: 840,
+ SubjectToVat: false,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Country_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Country_ToModel.verified.txt
new file mode 100644
index 000000000..946805143
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Country_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ Name: United States,
+ AllowsBilling: true,
+ AllowsShipping: true,
+ TwoLetterIsoCode: US,
+ ThreeLetterIsoCode: USA,
+ NumericIsoCode: 840,
+ SubjectToVat: false,
+ Published: true,
+ DisplayOrder: 1,
+ NumberOfStates: 1,
+ Id: country-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CurrencyModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CurrencyModel_ToDomain.verified.txt
new file mode 100644
index 000000000..9f1edbc2d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.CurrencyModel_ToDomain.verified.txt
@@ -0,0 +1,13 @@
+{
+ Name: US Dollar,
+ CurrencyCode: USD,
+ Rate: 1.0,
+ DisplayLocale: en-US,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Currency_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Currency_ToModel.verified.txt
new file mode 100644
index 000000000..4f6efd9a7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Currency_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ Name: US Dollar,
+ CurrencyCode: USD,
+ DisplayLocale: en-US,
+ Rate: 1.0,
+ CustomFormatting: ${0:N2},
+ NumberDecimal: 2,
+ Published: true,
+ DisplayOrder: 1,
+ IsPrimaryExchangeRateCurrency: false,
+ IsPrimaryStoreCurrency: false,
+ Id: cur-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentModel_ToDomain.verified.txt
new file mode 100644
index 000000000..479b9b2b7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentModel_ToDomain.verified.txt
@@ -0,0 +1,15 @@
+{
+ Number: INV-001,
+ Name: Invoice #001,
+ Published: true,
+ DocumentTypeId: dt-001,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentTypeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentTypeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..ede2b9b71
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentTypeModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Invoice,
+ Description: An invoice document,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentType_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentType_ToModel.verified.txt
new file mode 100644
index 000000000..6ec218b4f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DocumentType_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Invoice,
+ Description: An invoice document,
+ DisplayOrder: 1,
+ Id: dt-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Document_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Document_ToModel.verified.txt
new file mode 100644
index 000000000..7a0fbc849
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Document_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ Number: INV-001,
+ Name: Invoice #001,
+ Published: true,
+ DisplayOrder: 1,
+ CustomerId: cust-001,
+ ReferenceId: 10,
+ DocumentTypeId: dt-001,
+ CurrencyCode: USD,
+ TotalAmount: 500.0,
+ Id: doc-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHostModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHostModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5a573bdc3
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHostModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Url: https://example.com,
+ Primary: true,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHost_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHost_ToModel.verified.txt
new file mode 100644
index 000000000..ecb9817b3
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.DomainHost_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Url: https://example.com,
+ Primary: true,
+ Id: dh-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.LanguageModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.LanguageModel_ToDomain.verified.txt
new file mode 100644
index 000000000..bf3bf0e03
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.LanguageModel_ToDomain.verified.txt
@@ -0,0 +1,14 @@
+{
+ Name: English,
+ LanguageCulture: en-US,
+ UniqueSeoCode: en,
+ FlagImageFileName: us.png,
+ Rtl: false,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Language_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Language_ToModel.verified.txt
new file mode 100644
index 000000000..73282184a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Language_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: English,
+ LanguageCulture: en-US,
+ UniqueSeoCode: en,
+ FlagImageFileName: us.png,
+ Rtl: false,
+ DefaultCurrencyId: cur-001,
+ Published: true,
+ DisplayOrder: 1,
+ Search: {},
+ Id: lang-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimensionModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimensionModel_ToDomain.verified.txt
new file mode 100644
index 000000000..b7484f650
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimensionModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Centimeter,
+ SystemKeyword: cm,
+ Ratio: 1.0,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimension_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimension_ToModel.verified.txt
new file mode 100644
index 000000000..cfbb9c902
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureDimension_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Centimeter,
+ SystemKeyword: cm,
+ Ratio: 1.0,
+ DisplayOrder: 1,
+ IsPrimaryDimension: false,
+ Id: md-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnitModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnitModel_ToDomain.verified.txt
new file mode 100644
index 000000000..b0f4d5cde
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnitModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Piece,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnit_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnit_ToModel.verified.txt
new file mode 100644
index 000000000..83c9fe2ec
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureUnit_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Piece,
+ DisplayOrder: 1,
+ Id: mu-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeightModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeightModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5fe102c72
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeightModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Kilogram,
+ SystemKeyword: kg,
+ Ratio: 1.0,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeight_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeight_ToModel.verified.txt
new file mode 100644
index 000000000..f5e463e33
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MeasureWeight_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Kilogram,
+ SystemKeyword: kg,
+ Ratio: 1.0,
+ DisplayOrder: 1,
+ IsPrimaryWeight: false,
+ Id: mw-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnActionModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnActionModel_ToDomain.verified.txt
new file mode 100644
index 000000000..4a3b6777a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnActionModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Refund,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnAction_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnAction_ToModel.verified.txt
new file mode 100644
index 000000000..4c5f3a6d6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnAction_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Refund,
+ DisplayOrder: 1,
+ Id: mra-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReasonModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReasonModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5c671d38b
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReasonModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Defective,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReason_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReason_ToModel.verified.txt
new file mode 100644
index 000000000..4423baa4b
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReason_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Defective,
+ DisplayOrder: 1,
+ Id: mrr-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatusModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatusModel_ToDomain.verified.txt
new file mode 100644
index 000000000..1d84791a6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatusModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Processing,
+ DisplayOrder: 2,
+ IsSystem: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatus_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatus_ToModel.verified.txt
new file mode 100644
index 000000000..1d1f7d885
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.OrderStatus_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Processing,
+ DisplayOrder: 2,
+ Id: os-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PermissionCreateModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PermissionCreateModel_ToDomain.verified.txt
new file mode 100644
index 000000000..15f9946c7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PermissionCreateModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Manage Products,
+ SystemName: ManageProducts,
+ Area: Admin,
+ Category: Catalog,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Permission_ToUpdateModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Permission_ToUpdateModel.verified.txt
new file mode 100644
index 000000000..542a6b199
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Permission_ToUpdateModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Manage Products,
+ SystemName: ManageProducts,
+ Area: Admin,
+ Category: Catalog,
+ Id: perm-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPointModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPointModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c519b9227
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPointModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: Main Store Pickup,
+ Address: {
+ Id: ObjectId_1
+ },
+ StoreId: store-001,
+ PickupFee: 2.0,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPoint_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPoint_ToModel.verified.txt
new file mode 100644
index 000000000..67f7da7bb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.PickupPoint_ToModel.verified.txt
@@ -0,0 +1,40 @@
+{
+ Name: Main Store Pickup,
+ Description: Pickup at main store,
+ AdminComment: Note,
+ Address: {
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false
+ },
+ DisplayOrder: 1,
+ StoreId: store-001,
+ PickupFee: 2.0,
+ Latitude: 40.7128,
+ Longitude: -74.006,
+ Id: pp-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvinceModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvinceModel_ToDomain.verified.txt
new file mode 100644
index 000000000..972935134
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvinceModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: New York,
+ Abbreviation: NY,
+ Published: true,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvince_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvince_ToModel.verified.txt
new file mode 100644
index 000000000..caa44e425
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StateProvince_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: New York,
+ Abbreviation: NY,
+ Published: true,
+ DisplayOrder: 1,
+ Id: sp-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StoreModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StoreModel_ToDomain.verified.txt
new file mode 100644
index 000000000..28ae0fd58
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.StoreModel_ToDomain.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: Grand Store,
+ Url: https://grandstore.com,
+ SslEnabled: true,
+ DefaultLanguageId: lang-001,
+ DisplayOrder: 1,
+ CompanyName: Grand LLC,
+ BankAccount: {
+ Id: ObjectId_1
+ },
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Store_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Store_ToModel.verified.txt
new file mode 100644
index 000000000..37baa2633
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Store_ToModel.verified.txt
@@ -0,0 +1,26 @@
+{
+ Name: Grand Store,
+ Url: https://grandstore.com,
+ SslEnabled: true,
+ DisplayOrder: 1,
+ CompanyName: Grand LLC,
+ CompanyAddress: 123 Commerce St,
+ CompanyPhoneNumber: +1-555-9999,
+ CompanyVat: US123456,
+ DefaultLanguageId: lang-001,
+ DefaultCountryId: country-001,
+ DefaultCurrencyId: cur-001,
+ Domains: [
+ {
+ Url: https://grandstore.com,
+ Primary: true,
+ Id: dh-001
+ }
+ ],
+ BankAccount: {
+ BankCode: CHASUSU,
+ BankName: Chase,
+ Id: ObjectId_1
+ },
+ Id: store-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategoryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategoryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c7e6388b1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategoryModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Standard Rate,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategory_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategory_ToModel.verified.txt
new file mode 100644
index 000000000..bda61aa29
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.TaxCategory_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Standard Rate,
+ DisplayOrder: 1,
+ Id: tc-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.WarehouseModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.WarehouseModel_ToDomain.verified.txt
new file mode 100644
index 000000000..fefab2adb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.WarehouseModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ Code: WH-MAIN,
+ Name: Main Warehouse,
+ AdminComment: Primary,
+ Address: {
+ Id: ObjectId_1
+ },
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Warehouse_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Warehouse_ToModel.verified.txt
new file mode 100644
index 000000000..530412588
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.Warehouse_ToModel.verified.txt
@@ -0,0 +1,37 @@
+{
+ Code: WH-MAIN,
+ Name: Main Warehouse,
+ AdminComment: Primary warehouse,
+ Address: {
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ Id: ObjectId_1
+ },
+ DisplayOrder: 1,
+ Id: wh-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.cs
new file mode 100644
index 000000000..19729d55f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.cs
@@ -0,0 +1,594 @@
+using Grand.Mapping;
+using Grand.Domain.Common;
+using Grand.Domain.Directory;
+using Grand.Domain.Documents;
+using Grand.Domain.Localization;
+using Grand.Domain.Orders;
+using Grand.Domain.Permissions;
+using Grand.Domain.Shipping;
+using Grand.Domain.Stores;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Common;
+using Grand.Web.AdminShared.Models.Directory;
+using Grand.Web.AdminShared.Models.Documents;
+using Grand.Web.AdminShared.Models.Localization;
+using Grand.Web.AdminShared.Models.Orders;
+using Grand.Web.AdminShared.Models.Permissions;
+using Grand.Web.AdminShared.Models.Settings;
+using Grand.Web.AdminShared.Models.Shipping;
+using Grand.Web.AdminShared.Models.Stores;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class CommonMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<AddressProfile>();
+ cfg.AddProfile<AddressAttributeProfile>();
+ cfg.AddProfile<AddressAttributeValueProfile>();
+ cfg.AddProfile<CountryProfile>();
+ cfg.AddProfile<StateProvinceProfile>();
+ cfg.AddProfile<CurrencyProfile>();
+ cfg.AddProfile<LanguageProfile>();
+ cfg.AddProfile<MeasureDimensionProfile>();
+ cfg.AddProfile<MeasureWeightProfile>();
+ cfg.AddProfile<MeasureUnitProfile>();
+ cfg.AddProfile<StoreProfile>();
+ cfg.AddProfile<DocumentProfile>();
+ cfg.AddProfile<DocumentTypeProfile>();
+ cfg.AddProfile<OrderStatusProfile>();
+ cfg.AddProfile<MerchandiseReturnActionProfile>();
+ cfg.AddProfile<MerchandiseReturnReasonProfile>();
+ cfg.AddProfile<PickupPointProfile>();
+ cfg.AddProfile<WarehouseProfile>();
+ cfg.AddProfile<PermissionProfile>();
+ cfg.AddProfile<TaxCategoryProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Address ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Address_ToModel()
+ {
+ var source = new Address {
+ Id = "addr-001",
+ FirstName = "John",
+ LastName = "Doe",
+ Email = "[email protected]",
+ Company = "ACME Corp",
+ CountryId = "country-001",
+ StateProvinceId = "state-001",
+ City = "New York",
+ Address1 = "123 Main St",
+ Address2 = "Apt 4B",
+ ZipPostalCode = "10001",
+ PhoneNumber = "+1-555-1234",
+ FaxNumber = "+1-555-5678"
+ };
+ return Verify(_mapper.Map<AddressModel>(source));
+ }
+
+ [TestMethod]
+ public Task AddressModel_ToDomain()
+ {
+ var model = new AddressModel {
+ FirstName = "John",
+ LastName = "Doe",
+ Email = "[email protected]",
+ Company = "ACME Corp",
+ CountryId = "country-001",
+ StateProvinceId = "state-001",
+ City = "New York",
+ Address1 = "123 Main St",
+ Address2 = "Apt 4B",
+ ZipPostalCode = "10001",
+ PhoneNumber = "+1-555-1234"
+ };
+ return Verify(_mapper.Map<Address>(model));
+ }
+
+ // ── AddressAttribute ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AddressAttribute_ToModel()
+ {
+ var source = new AddressAttribute {
+ Id = "aa-001",
+ Name = "Custom Field",
+ IsRequired = true,
+ AttributeControlTypeId = 1,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<AddressAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task AddressAttributeModel_ToDomain()
+ {
+ var model = new AddressAttributeModel {
+ Name = "Custom Field",
+ IsRequired = true,
+ AttributeControlTypeId = 1,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<AddressAttribute>(model));
+ }
+
+ // ── AddressAttributeValue ─────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AddressAttributeValue_ToModel()
+ {
+ var source = new AddressAttributeValue {
+ Id = "aav-001",
+ Name = "Option A",
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<AddressAttributeValueModel>(source));
+ }
+
+ [TestMethod]
+ public Task AddressAttributeValueModel_ToDomain()
+ {
+ var model = new AddressAttributeValueModel {
+ Name = "Option A",
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<AddressAttributeValue>(model));
+ }
+
+ // ── Country ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Country_ToModel()
+ {
+ var source = new Country {
+ Id = "country-001",
+ Name = "United States",
+ AllowsBilling = true,
+ AllowsShipping = true,
+ TwoLetterIsoCode = "US",
+ ThreeLetterIsoCode = "USA",
+ NumericIsoCode = 840,
+ SubjectToVat = false,
+ Published = true,
+ DisplayOrder = 1,
+ };
+ source.StateProvinces.Add(new StateProvince { Id = "sp-001", Name = "New York" });
+ return Verify(_mapper.Map<CountryModel>(source));
+ }
+
+ [TestMethod]
+ public Task CountryModel_ToDomain()
+ {
+ var model = new CountryModel {
+ Name = "United States",
+ AllowsBilling = true,
+ AllowsShipping = true,
+ TwoLetterIsoCode = "US",
+ ThreeLetterIsoCode = "USA",
+ NumericIsoCode = 840,
+ Published = true,
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Country>(model));
+ }
+
+ // ── StateProvince ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task StateProvince_ToModel()
+ {
+ var source = new StateProvince {
+ Id = "sp-001",
+ Name = "New York",
+ Abbreviation = "NY",
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<StateProvinceModel>(source));
+ }
+
+ [TestMethod]
+ public Task StateProvinceModel_ToDomain()
+ {
+ var model = new StateProvinceModel {
+ Name = "New York",
+ Abbreviation = "NY",
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<StateProvince>(model));
+ }
+
+ // ── Currency ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Currency_ToModel()
+ {
+ var source = new Currency {
+ Id = "cur-001",
+ Name = "US Dollar",
+ CurrencyCode = "USD",
+ Rate = 1.0,
+ DisplayLocale = "en-US",
+ CustomFormatting = "${0:N2}",
+ Published = true,
+ DisplayOrder = 1,
+ RoundingTypeId = 0,
+ MidpointRoundId = 0
+ };
+ return Verify(_mapper.Map<CurrencyModel>(source));
+ }
+
+ [TestMethod]
+ public Task CurrencyModel_ToDomain()
+ {
+ var model = new CurrencyModel {
+ Name = "US Dollar",
+ CurrencyCode = "USD",
+ Rate = 1.0,
+ DisplayLocale = "en-US",
+ Published = true,
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Currency>(model));
+ }
+
+ // ── Language ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Language_ToModel()
+ {
+ var source = new Language {
+ Id = "lang-001",
+ Name = "English",
+ LanguageCulture = "en-US",
+ UniqueSeoCode = "en",
+ FlagImageFileName = "us.png",
+ Rtl = false,
+ Published = true,
+ DisplayOrder = 1,
+ DefaultCurrencyId = "cur-001"
+ };
+ return Verify(_mapper.Map<LanguageModel>(source));
+ }
+
+ [TestMethod]
+ public Task LanguageModel_ToDomain()
+ {
+ var model = new LanguageModel {
+ Name = "English",
+ LanguageCulture = "en-US",
+ UniqueSeoCode = "en",
+ FlagImageFileName = "us.png",
+ Rtl = false,
+ Published = true,
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Language>(model));
+ }
+
+ // ── MeasureDimension ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MeasureDimension_ToModel()
+ {
+ var source = new MeasureDimension { Id = "md-001", Name = "Centimeter", SystemKeyword = "cm", Ratio = 1.0, DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureDimensionModel>(source));
+ }
+
+ [TestMethod]
+ public Task MeasureDimensionModel_ToDomain()
+ {
+ var model = new MeasureDimensionModel { Name = "Centimeter", SystemKeyword = "cm", Ratio = 1.0, DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureDimension>(model));
+ }
+
+ // ── MeasureWeight ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MeasureWeight_ToModel()
+ {
+ var source = new MeasureWeight { Id = "mw-001", Name = "Kilogram", SystemKeyword = "kg", Ratio = 1.0, DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureWeightModel>(source));
+ }
+
+ [TestMethod]
+ public Task MeasureWeightModel_ToDomain()
+ {
+ var model = new MeasureWeightModel { Name = "Kilogram", SystemKeyword = "kg", Ratio = 1.0, DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureWeight>(model));
+ }
+
+ // ── MeasureUnit ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MeasureUnit_ToModel()
+ {
+ var source = new MeasureUnit { Id = "mu-001", Name = "Piece", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureUnitModel>(source));
+ }
+
+ [TestMethod]
+ public Task MeasureUnitModel_ToDomain()
+ {
+ var model = new MeasureUnitModel { Name = "Piece", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MeasureUnit>(model));
+ }
+
+ // ── Store ─────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Store_ToModel()
+ {
+ var source = new Store {
+ Id = "store-001",
+ Name = "Grand Store",
+ Url = "https://grandstore.com",
+ SslEnabled = true,
+ CompanyName = "Grand LLC",
+ CompanyAddress = "123 Commerce St",
+ CompanyPhoneNumber = "+1-555-9999",
+ CompanyVat = "US123456",
+ DisplayOrder = 1,
+ DefaultLanguageId = "lang-001",
+ DefaultCurrencyId = "cur-001",
+ DefaultCountryId = "country-001",
+ Domains = [new DomainHost { Id = "dh-001", Url = "https://grandstore.com", Primary = true }],
+ BankAccount = new BankAccount { BankName = "Chase", BankCode = "CHASUSU" }
+ };
+ return Verify(_mapper.Map<StoreModel>(source));
+ }
+
+ [TestMethod]
+ public Task StoreModel_ToDomain()
+ {
+ var model = new StoreModel {
+ Name = "Grand Store",
+ Url = "https://grandstore.com",
+ SslEnabled = true,
+ CompanyName = "Grand LLC",
+ DefaultLanguageId = "lang-001",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<Store>(model));
+ }
+
+ [TestMethod]
+ public Task DomainHost_ToModel()
+ {
+ var source = new DomainHost { Id = "dh-001", Url = "https://example.com", Primary = true };
+ return Verify(_mapper.Map<DomainHostModel>(source));
+ }
+
+ [TestMethod]
+ public Task DomainHostModel_ToDomain()
+ {
+ var model = new DomainHostModel { Url = "https://example.com", Primary = true };
+ return Verify(_mapper.Map<DomainHost>(model));
+ }
+
+ [TestMethod]
+ public Task BankAccount_ToModel()
+ {
+ var source = new BankAccount { BankName = "Chase", BankCode = "CHASE123", SwiftCode = "CHASUS33", AccountNumber = "123456789" };
+ return Verify(_mapper.Map<StoreModel.BankAccountModel>(source));
+ }
+
+ // ── Document ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Document_ToModel()
+ {
+ var source = new Document {
+ Id = "doc-001",
+ Name = "Invoice #001",
+ Number = "INV-001",
+ DocumentTypeId = "dt-001",
+ CustomerId = "cust-001",
+ ReferenceId = Reference.Order,
+ StatusId = DocumentStatus.Open,
+ DisplayOrder = 1,
+ Published = true,
+ TotalAmount = 500,
+ OutstandAmount = 0,
+ CurrencyCode = "USD"
+ };
+ return Verify(_mapper.Map<DocumentModel>(source));
+ }
+
+ [TestMethod]
+ public Task DocumentModel_ToDomain()
+ {
+ var model = new DocumentModel {
+ Name = "Invoice #001",
+ Number = "INV-001",
+ DocumentTypeId = "dt-001",
+ Published = true,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Document>(model));
+ }
+
+ // ── DocumentType ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task DocumentType_ToModel()
+ {
+ var source = new DocumentType { Id = "dt-001", Name = "Invoice", Description = "An invoice document", DisplayOrder = 1 };
+ return Verify(_mapper.Map<DocumentTypeModel>(source));
+ }
+
+ [TestMethod]
+ public Task DocumentTypeModel_ToDomain()
+ {
+ var model = new DocumentTypeModel { Name = "Invoice", Description = "An invoice document", DisplayOrder = 1 };
+ return Verify(_mapper.Map<DocumentType>(model));
+ }
+
+ // ── OrderStatus ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task OrderStatus_ToModel()
+ {
+ var source = new OrderStatus { Id = "os-001", Name = "Processing", DisplayOrder = 2 };
+ return Verify(_mapper.Map<OrderStatusModel>(source));
+ }
+
+ [TestMethod]
+ public Task OrderStatusModel_ToDomain()
+ {
+ var model = new OrderStatusModel { Name = "Processing", DisplayOrder = 2 };
+ return Verify(_mapper.Map<OrderStatus>(model));
+ }
+
+ // ── MerchandiseReturnAction ───────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MerchandiseReturnAction_ToModel()
+ {
+ var source = new MerchandiseReturnAction { Id = "mra-001", Name = "Refund", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MerchandiseReturnActionModel>(source));
+ }
+
+ [TestMethod]
+ public Task MerchandiseReturnActionModel_ToDomain()
+ {
+ var model = new MerchandiseReturnActionModel { Name = "Refund", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MerchandiseReturnAction>(model));
+ }
+
+ // ── MerchandiseReturnReason ───────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MerchandiseReturnReason_ToModel()
+ {
+ var source = new MerchandiseReturnReason { Id = "mrr-001", Name = "Defective", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MerchandiseReturnReasonModel>(source));
+ }
+
+ [TestMethod]
+ public Task MerchandiseReturnReasonModel_ToDomain()
+ {
+ var model = new MerchandiseReturnReasonModel { Name = "Defective", DisplayOrder = 1 };
+ return Verify(_mapper.Map<MerchandiseReturnReason>(model));
+ }
+
+ // ── PickupPoint ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PickupPoint_ToModel()
+ {
+ var source = new PickupPoint {
+ Id = "pp-001",
+ Name = "Main Store Pickup",
+ Description = "Pickup at main store",
+ AdminComment = "Note",
+ PickupFee = 2.00,
+ DisplayOrder = 1,
+ StoreId = "store-001",
+ Latitude = 40.7128,
+ Longitude = -74.0060
+ };
+ return Verify(_mapper.Map<PickupPointModel>(source));
+ }
+
+ [TestMethod]
+ public Task PickupPointModel_ToDomain()
+ {
+ var model = new PickupPointModel {
+ Name = "Main Store Pickup",
+ PickupFee = 2.00,
+ DisplayOrder = 1,
+ StoreId = "store-001"
+ };
+ return Verify(_mapper.Map<PickupPoint>(model));
+ }
+
+ // ── Warehouse ─────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Warehouse_ToModel()
+ {
+ var source = new Warehouse {
+ Id = "wh-001",
+ Name = "Main Warehouse",
+ AdminComment = "Primary warehouse",
+ Code = "WH-MAIN",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<WarehouseModel>(source));
+ }
+
+ [TestMethod]
+ public Task WarehouseModel_ToDomain()
+ {
+ var model = new WarehouseModel {
+ Name = "Main Warehouse",
+ AdminComment = "Primary",
+ Code = "WH-MAIN",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<Warehouse>(model));
+ }
+
+ // ── Permission ────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PermissionCreateModel_ToDomain()
+ {
+ var model = new PermissionCreateModel {
+ Name = "Manage Products",
+ SystemName = "ManageProducts",
+ Area = "Admin",
+ Category = "Catalog"
+ };
+ return Verify(_mapper.Map<Permission>(model));
+ }
+
+ [TestMethod]
+ public Task Permission_ToUpdateModel()
+ {
+ var source = new Permission {
+ Id = "perm-001",
+ Name = "Manage Products",
+ SystemName = "ManageProducts",
+ Area = "Admin",
+ Category = "Catalog"
+ };
+ return Verify(_mapper.Map<PermissionUpdateModel>(source));
+ }
+
+ // ── TaxCategory ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task TaxCategory_ToModel()
+ {
+ var source = new Grand.Domain.Tax.TaxCategory { Id = "tc-001", Name = "Standard Rate", DisplayOrder = 1 };
+ return Verify(_mapper.Map<Grand.Web.AdminShared.Models.Tax.TaxCategoryModel>(source));
+ }
+
+ [TestMethod]
+ public Task TaxCategoryModel_ToDomain()
+ {
+ var model = new Grand.Web.AdminShared.Models.Tax.TaxCategoryModel { Name = "Standard Rate", DisplayOrder = 1 };
+ return Verify(_mapper.Map<Grand.Domain.Tax.TaxCategory>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategoryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategoryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..d106fec2e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategoryModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: Tech News,
+ SeName: tech-news,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategory_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategory_ToModel.verified.txt
new file mode 100644
index 000000000..32279684d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogCategory_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Tech News,
+ SeName: tech-news,
+ DisplayOrder: 1,
+ Id: bc-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPostModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPostModel_ToDomain.verified.txt
new file mode 100644
index 000000000..7c79ce9c7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPostModel_ToDomain.verified.txt
@@ -0,0 +1,12 @@
+{
+ Title: First Post,
+ Body: Content body,
+ BodyOverview: Overview,
+ AllowComments: true,
+ Tags: tech,blog,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPost_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPost_ToModel.verified.txt
new file mode 100644
index 000000000..99ace7a99
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogPost_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ Title: First Post,
+ Body: Content body,
+ BodyOverview: Overview,
+ AllowComments: true,
+ Tags: tech,blog,
+ MetaKeywords: blog,
+ MetaDescription: Blog post,
+ MetaTitle: First Post,
+ SeName: first-post,
+ Id: bp-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c30091cb8
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,8 @@
+{
+ Enabled: true,
+ PostsPageSize: 10,
+ AllowNotRegisteredUsersToLeaveComments: false,
+ NotifyAboutNewBlogComments: false,
+ ShowBlogOnHomePage: false,
+ ShowBlogPostsInSearchAutoComplete: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettings_ToModel.verified.txt
new file mode 100644
index 000000000..c30091cb8
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.BlogSettings_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Enabled: true,
+ PostsPageSize: 10,
+ AllowNotRegisteredUsersToLeaveComments: false,
+ NotifyAboutNewBlogComments: false,
+ ShowBlogOnHomePage: false,
+ ShowBlogPostsInSearchAutoComplete: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLessonModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLessonModel_ToDomain.verified.txt
new file mode 100644
index 000000000..428f11a96
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLessonModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ Name: Introduction,
+ ShortDescription: Lesson overview,
+ DisplayOrder: 1,
+ CourseId: course-001,
+ SubjectId: subj-001,
+ Published: true,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLesson_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLesson_ToModel.verified.txt
new file mode 100644
index 000000000..4f24f42d7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLesson_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: Introduction,
+ ShortDescription: Lesson overview,
+ DisplayOrder: 1,
+ CourseId: course-001,
+ SubjectId: subj-001,
+ VideoFile: intro.mp4,
+ AttachmentId: attach-001,
+ Published: true,
+ Id: lesson-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevelModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevelModel_ToDomain.verified.txt
new file mode 100644
index 000000000..b8d834834
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevelModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Beginner,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevel_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevel_ToModel.verified.txt
new file mode 100644
index 000000000..98dc30c12
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseLevel_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Beginner,
+ DisplayOrder: 1,
+ Id: cl-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseModel_ToDomain.verified.txt
new file mode 100644
index 000000000..608d5aabe
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseModel_ToDomain.verified.txt
@@ -0,0 +1,17 @@
+{
+ Name: C# Fundamentals,
+ Description: Full course,
+ ShortDescription: Learn C#,
+ Published: true,
+ DisplayOrder: 1,
+ LevelId: cl-001,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubjectModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubjectModel_ToDomain.verified.txt
new file mode 100644
index 000000000..1395e2638
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubjectModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Chapter 1,
+ DisplayOrder: 1,
+ CourseId: course-001,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubject_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubject_ToModel.verified.txt
new file mode 100644
index 000000000..61c7a19d9
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.CourseSubject_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Chapter 1,
+ DisplayOrder: 1,
+ CourseId: course-001,
+ Id: subj-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Course_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Course_ToModel.verified.txt
new file mode 100644
index 000000000..9eac962eb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Course_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: C# Fundamentals,
+ ShortDescription: Learn C#,
+ Description: Full course,
+ DisplayOrder: 1,
+ Published: true,
+ LevelId: cl-001,
+ SeName: csharp-fundamentals,
+ ProductId: prod-001,
+ Id: course-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticleModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticleModel_ToDomain.verified.txt
new file mode 100644
index 000000000..7d129edf8
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticleModel_ToDomain.verified.txt
@@ -0,0 +1,18 @@
+{
+ Content: Step-by-step guide,
+ DisplayOrder: 1,
+ Published: true,
+ ShowOnHomepage: false,
+ AllowComments: false,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Name: How to order?,
+ ParentCategoryId: kb-001,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticle_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticle_ToModel.verified.txt
new file mode 100644
index 000000000..bc8e8f705
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseArticle_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: How to order?,
+ Content: Step-by-step guide,
+ ParentCategoryId: kb-001,
+ DisplayOrder: 1,
+ Published: true,
+ SeName: how-to-order,
+ ShowOnHomepage: false,
+ AllowComments: false,
+ Id: kba-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategoryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategoryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..86c800b01
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategoryModel_ToDomain.verified.txt
@@ -0,0 +1,15 @@
+{
+ DisplayOrder: 1,
+ Description: Frequently asked questions,
+ Published: true,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Name: FAQ,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategory_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategory_ToModel.verified.txt
new file mode 100644
index 000000000..bad8cb12a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseCategory_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: FAQ,
+ ParentCategoryId: ,
+ DisplayOrder: 1,
+ Description: Frequently asked questions,
+ Published: true,
+ SeName: faq,
+ LimitedToStores: false,
+ Id: kb-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..35a128db5
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Enabled: true,
+ AllowNotRegisteredUsersToLeaveComments: false,
+ NotifyAboutNewArticleComments: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettings_ToModel.verified.txt
new file mode 100644
index 000000000..35a128db5
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.KnowledgebaseSettings_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Enabled: true,
+ AllowNotRegisteredUsersToLeaveComments: false,
+ NotifyAboutNewArticleComments: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItemModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItemModel_ToDomain.verified.txt
new file mode 100644
index 000000000..e3dc99439
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItemModel_ToDomain.verified.txt
@@ -0,0 +1,16 @@
+{
+ Title: Breaking News,
+ Short: Short text,
+ Full: Full news content,
+ Published: true,
+ AllowComments: true,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItem_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItem_ToModel.verified.txt
new file mode 100644
index 000000000..988abc9ef
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsItem_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ Title: Breaking News,
+ Short: Short text,
+ Full: Full news content,
+ AllowComments: true,
+ MetaKeywords: news,
+ MetaDescription: News,
+ MetaTitle: Breaking News,
+ SeName: breaking-news,
+ Published: true,
+ Id: ni-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..52022629d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Enabled: true,
+ AllowNotRegisteredUsersToLeaveComments: false,
+ NotifyAboutNewNewsComments: false,
+ ShowNewsOnMainPage: true,
+ MainPageNewsCount: 3
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettings_ToModel.verified.txt
new file mode 100644
index 000000000..50c3472aa
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.NewsSettings_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Enabled: true,
+ AllowNotRegisteredUsersToLeaveComments: true,
+ NotifyAboutNewNewsComments: false,
+ ShowNewsOnMainPage: true,
+ MainPageNewsCount: 3
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.PageModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.PageModel_ToDomain.verified.txt
new file mode 100644
index 000000000..d52085a2d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.PageModel_ToDomain.verified.txt
@@ -0,0 +1,23 @@
+{
+ SystemName: about-us,
+ IncludeInSitemap: true,
+ IncludeInMenu: false,
+ IncludeInFooterRow1: false,
+ IncludeInFooterRow2: false,
+ IncludeInFooterRow3: false,
+ DisplayOrder: 1,
+ AccessibleWhenStoreClosed: false,
+ IsPasswordProtected: false,
+ Title: About Us,
+ Body: <p>About us page</p>,
+ Published: true,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Page_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Page_ToModel.verified.txt
new file mode 100644
index 000000000..de87b088d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.Page_ToModel.verified.txt
@@ -0,0 +1,20 @@
+{
+ SystemName: about-us,
+ IncludeInSitemap: true,
+ IncludeInMenu: false,
+ IncludeInFooterRow1: false,
+ IncludeInFooterRow2: false,
+ IncludeInFooterRow3: false,
+ DisplayOrder: 1,
+ AccessibleWhenStoreClosed: false,
+ IsPasswordProtected: false,
+ Published: true,
+ Title: About Us,
+ Body: <p>About us page</p>,
+ PageLayoutId: pl-001,
+ MetaKeywords: about,
+ MetaDescription: About us,
+ MetaTitle: About Us,
+ SeName: about-us,
+ Id: page-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.cs
new file mode 100644
index 000000000..3667332bf
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ContentMappingTests.cs
@@ -0,0 +1,390 @@
+using Grand.Mapping;
+using Grand.Domain.Blogs;
+using Grand.Domain.Courses;
+using Grand.Domain.Knowledgebase;
+using Grand.Domain.News;
+using Grand.Domain.Pages;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Blogs;
+using Grand.Web.AdminShared.Models.Courses;
+using Grand.Web.AdminShared.Models.Knowledgebase;
+using Grand.Web.AdminShared.Models.News;
+using Grand.Web.AdminShared.Models.Pages;
+using Grand.Web.AdminShared.Models.Settings;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class ContentMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<BlogCategoryProfile>();
+ cfg.AddProfile<BlogPostProfile>();
+ cfg.AddProfile<BlogSettingsProfile>();
+ cfg.AddProfile<NewsItemProfile>();
+ cfg.AddProfile<NewsSettingsProfile>();
+ cfg.AddProfile<PageProfile>();
+ cfg.AddProfile<KnowledgebaseCategoryProfile>();
+ cfg.AddProfile<KnowledgebaseSettingsProfile>();
+ cfg.AddProfile<CourseProfile>();
+ cfg.AddProfile<CourseLevelProfile>();
+ cfg.AddProfile<CourseLessonProfile>();
+ cfg.AddProfile<CourseSubjectProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── BlogCategory ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BlogCategory_ToModel()
+ {
+ var source = new BlogCategory {
+ Id = "bc-001",
+ Name = "Tech News",
+ SeName = "tech-news",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<BlogCategoryModel>(source));
+ }
+
+ [TestMethod]
+ public Task BlogCategoryModel_ToDomain()
+ {
+ var model = new BlogCategoryModel {
+ Name = "Tech News",
+ SeName = "tech-news",
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<BlogCategory>(model));
+ }
+
+ // ── BlogPost ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BlogPost_ToModel()
+ {
+ var source = new BlogPost {
+ Id = "bp-001",
+ Title = "First Post",
+ Body = "Content body",
+ BodyOverview = "Overview",
+ AllowComments = true,
+ Tags = "tech,blog",
+ StartDateUtc = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc),
+ EndDateUtc = new DateTime(2024, 12, 31, 0, 0, 0, DateTimeKind.Utc),
+ MetaKeywords = "blog",
+ MetaDescription = "Blog post",
+ MetaTitle = "First Post",
+ SeName = "first-post"
+ };
+ return Verify(_mapper.Map<BlogPostModel>(source));
+ }
+
+ [TestMethod]
+ public Task BlogPostModel_ToDomain()
+ {
+ var model = new BlogPostModel {
+ Title = "First Post",
+ Body = "Content body",
+ BodyOverview = "Overview",
+ AllowComments = true,
+ Tags = "tech,blog",
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<BlogPost>(model));
+ }
+
+ // ── BlogSettings ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BlogSettings_ToModel()
+ {
+ var source = new BlogSettings { Enabled = true, PostsPageSize = 10, AllowNotRegisteredUsersToLeaveComments = false };
+ return Verify(_mapper.Map<ContentSettingsModel.BlogSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task BlogSettingsModel_ToDomain()
+ {
+ var model = new ContentSettingsModel.BlogSettingsModel { Enabled = true, PostsPageSize = 10 };
+ return Verify(_mapper.Map<BlogSettings>(model));
+ }
+
+ // ── NewsItem ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task NewsItem_ToModel()
+ {
+ var source = new NewsItem {
+ Id = "ni-001",
+ Title = "Breaking News",
+ Short = "Short text",
+ Full = "Full news content",
+ Published = true,
+ AllowComments = true,
+ StartDateUtc = new DateTime(2024, 6, 1, 0, 0, 0, DateTimeKind.Utc),
+ EndDateUtc = new DateTime(2024, 6, 30, 0, 0, 0, DateTimeKind.Utc),
+ MetaKeywords = "news",
+ MetaDescription = "News",
+ MetaTitle = "Breaking News",
+ SeName = "breaking-news"
+ };
+ return Verify(_mapper.Map<NewsItemModel>(source));
+ }
+
+ [TestMethod]
+ public Task NewsItemModel_ToDomain()
+ {
+ var model = new NewsItemModel {
+ Title = "Breaking News",
+ Short = "Short text",
+ Full = "Full news content",
+ Published = true,
+ AllowComments = true,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<NewsItem>(model));
+ }
+
+ // ── NewsSettings ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task NewsSettings_ToModel()
+ {
+ var source = new NewsSettings { Enabled = true, AllowNotRegisteredUsersToLeaveComments = true, NotifyAboutNewNewsComments = false, ShowNewsOnMainPage = true, MainPageNewsCount = 3 };
+ return Verify(_mapper.Map<ContentSettingsModel.NewsSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task NewsSettingsModel_ToDomain()
+ {
+ var model = new ContentSettingsModel.NewsSettingsModel { Enabled = true, ShowNewsOnMainPage = true, MainPageNewsCount = 3 };
+ return Verify(_mapper.Map<NewsSettings>(model));
+ }
+
+ // ── Page ──────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Page_ToModel()
+ {
+ var source = new Page {
+ Id = "page-001",
+ SystemName = "about-us",
+ IncludeInSitemap = true,
+ IsPasswordProtected = false,
+ Published = true,
+ Title = "About Us",
+ Body = "<p>About us page</p>",
+ MetaKeywords = "about",
+ MetaDescription = "About us",
+ MetaTitle = "About Us",
+ DisplayOrder = 1,
+ SeName = "about-us",
+ PageLayoutId = "pl-001"
+ };
+ return Verify(_mapper.Map<PageModel>(source));
+ }
+
+ [TestMethod]
+ public Task PageModel_ToDomain()
+ {
+ var model = new PageModel {
+ SystemName = "about-us",
+ IncludeInSitemap = true,
+ Published = true,
+ Title = "About Us",
+ Body = "<p>About us page</p>",
+ DisplayOrder = 1,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Page>(model));
+ }
+
+ // ── KnowledgebaseCategory ─────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task KnowledgebaseCategory_ToModel()
+ {
+ var source = new KnowledgebaseCategory {
+ Id = "kb-001",
+ Name = "FAQ",
+ Description = "Frequently asked questions",
+ ParentCategoryId = "",
+ DisplayOrder = 1,
+ Published = true,
+ SeName = "faq"
+ };
+ return Verify(_mapper.Map<KnowledgebaseCategoryModel>(source));
+ }
+
+ [TestMethod]
+ public Task KnowledgebaseCategoryModel_ToDomain()
+ {
+ var model = new KnowledgebaseCategoryModel {
+ Name = "FAQ",
+ Description = "Frequently asked questions",
+ DisplayOrder = 1,
+ Published = true,
+ Stores = ["store-001"],
+ CustomerGroups = ["grp-001"]
+ };
+ return Verify(_mapper.Map<KnowledgebaseCategory>(model));
+ }
+
+ [TestMethod]
+ public Task KnowledgebaseArticle_ToModel()
+ {
+ var source = new KnowledgebaseArticle {
+ Id = "kba-001",
+ Name = "How to order?",
+ Content = "Step-by-step guide",
+ ParentCategoryId = "kb-001",
+ DisplayOrder = 1,
+ Published = true,
+ SeName = "how-to-order"
+ };
+ return Verify(_mapper.Map<KnowledgebaseArticleModel>(source));
+ }
+
+ [TestMethod]
+ public Task KnowledgebaseArticleModel_ToDomain()
+ {
+ var model = new KnowledgebaseArticleModel {
+ Name = "How to order?",
+ Content = "Step-by-step guide",
+ ParentCategoryId = "kb-001",
+ DisplayOrder = 1,
+ Published = true,
+ Stores = ["store-001"],
+ CustomerGroups = ["grp-001"]
+ };
+ return Verify(_mapper.Map<KnowledgebaseArticle>(model));
+ }
+
+ // ── KnowledgebaseSettings ─────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task KnowledgebaseSettings_ToModel()
+ {
+ var source = new KnowledgebaseSettings { Enabled = true, AllowNotRegisteredUsersToLeaveComments = false };
+ return Verify(_mapper.Map<ContentSettingsModel.KnowledgebaseSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task KnowledgebaseSettingsModel_ToDomain()
+ {
+ var model = new ContentSettingsModel.KnowledgebaseSettingsModel { Enabled = true };
+ return Verify(_mapper.Map<KnowledgebaseSettings>(model));
+ }
+
+ // ── Course ────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Course_ToModel()
+ {
+ var source = new Course {
+ Id = "course-001",
+ Name = "C# Fundamentals",
+ ShortDescription = "Learn C#",
+ Description = "Full course",
+ LevelId = "cl-001",
+ Published = true,
+ DisplayOrder = 1,
+ SeName = "csharp-fundamentals",
+ ProductId = "prod-001"
+ };
+ return Verify(_mapper.Map<CourseModel>(source));
+ }
+
+ [TestMethod]
+ public Task CourseModel_ToDomain()
+ {
+ var model = new CourseModel {
+ Name = "C# Fundamentals",
+ ShortDescription = "Learn C#",
+ Description = "Full course",
+ LevelId = "cl-001",
+ Published = true,
+ DisplayOrder = 1,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<Course>(model));
+ }
+
+ // ── CourseLevel ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CourseLevel_ToModel()
+ {
+ var source = new CourseLevel { Id = "cl-001", Name = "Beginner", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CourseLevelModel>(source));
+ }
+
+ [TestMethod]
+ public Task CourseLevelModel_ToDomain()
+ {
+ var model = new CourseLevelModel { Name = "Beginner", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CourseLevel>(model));
+ }
+
+ // ── CourseLesson ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CourseLesson_ToModel()
+ {
+ var source = new CourseLesson {
+ Id = "lesson-001",
+ Name = "Introduction",
+ ShortDescription = "Lesson overview",
+ SubjectId = "subj-001",
+ CourseId = "course-001",
+ DisplayOrder = 1,
+ Published = true,
+ AttachmentId = "attach-001",
+ VideoFile = "intro.mp4"
+ };
+ return Verify(_mapper.Map<CourseLessonModel>(source));
+ }
+
+ [TestMethod]
+ public Task CourseLessonModel_ToDomain()
+ {
+ var model = new CourseLessonModel {
+ Name = "Introduction",
+ ShortDescription = "Lesson overview",
+ SubjectId = "subj-001",
+ CourseId = "course-001",
+ DisplayOrder = 1,
+ Published = true
+ };
+ return Verify(_mapper.Map<CourseLesson>(model));
+ }
+
+ // ── CourseSubject ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CourseSubject_ToModel()
+ {
+ var source = new CourseSubject { Id = "subj-001", Name = "Chapter 1", CourseId = "course-001", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CourseSubjectModel>(source));
+ }
+
+ [TestMethod]
+ public Task CourseSubjectModel_ToDomain()
+ {
+ var model = new CourseSubjectModel { Name = "Chapter 1", CourseId = "course-001", DisplayOrder = 1 };
+ return Verify(_mapper.Map<CourseSubject>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..d1cc0e0e6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,16 @@
+{
+ Name: Preferred Contact,
+ IsRequired: false,
+ AttributeControlTypeId: 1,
+ DisplayOrder: 1,
+ AttributeControlType: DropdownList,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValueModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValueModel_ToDomain.verified.txt
new file mode 100644
index 000000000..f129dde24
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValueModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Email,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValue_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValue_ToModel.verified.txt
new file mode 100644
index 000000000..2c5c6fc04
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttributeValue_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Email,
+ DisplayColorSquaresRgb: false,
+ IsPreSelected: true,
+ DisplayOrder: 1,
+ Id: coav-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..54aec7598
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactAttribute_ToModel.verified.txt
@@ -0,0 +1,9 @@
+{
+ Name: Preferred Contact,
+ TextPrompt: How would you like to be contacted?,
+ IsRequired: false,
+ AttributeControlTypeId: 1,
+ DisplayOrder: 1,
+ ConditionAllowed: false,
+ Id: coa-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactUs_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactUs_ToModel.verified.txt
new file mode 100644
index 000000000..3bafb5aac
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.ContactUs_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Id: cu-001,
+ FullName: Jane Doe,
+ IpAddress: 192.168.1.1,
+ Subject: Order inquiry,
+ Enquiry: When will my order arrive?
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..60adbf5d0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Newsletter Preference,
+ IsRequired: false,
+ IsReadOnly: false,
+ AttributeControlTypeId: RadioList,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValueModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValueModel_ToDomain.verified.txt
new file mode 100644
index 000000000..1e042f157
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValueModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Weekly,
+ IsPreSelected: false,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValue_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValue_ToModel.verified.txt
new file mode 100644
index 000000000..9bb22f976
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttributeValue_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Weekly,
+ IsPreSelected: false,
+ DisplayOrder: 1,
+ Id: cav-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..9725c2340
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerAttribute_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Newsletter Preference,
+ IsRequired: false,
+ IsReadOnly: false,
+ AttributeControlTypeId: 2,
+ DisplayOrder: 1,
+ Id: ca-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroupModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroupModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8783e58e1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroupModel_ToDomain.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: VIP Customers,
+ FreeShipping: true,
+ TaxExempt: false,
+ Active: true,
+ IsSystem: false,
+ SystemName: vip,
+ EnablePasswordLifetime: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroup_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroup_ToModel.verified.txt
new file mode 100644
index 000000000..75317b7e6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerGroup_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: VIP Customers,
+ FreeShipping: true,
+ TaxExempt: false,
+ Active: true,
+ IsSystem: false,
+ SystemName: vip,
+ EnablePasswordLifetime: false,
+ Id: cg-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTagModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTagModel_ToDomain.verified.txt
new file mode 100644
index 000000000..264423ebf
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTagModel_ToDomain.verified.txt
@@ -0,0 +1,4 @@
+{
+ Name: BigSpender,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTag_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTag_ToModel.verified.txt
new file mode 100644
index 000000000..304206b55
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.CustomerTag_ToModel.verified.txt
@@ -0,0 +1,4 @@
+{
+ Name: BigSpender,
+ Id: ct-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscriptionModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscriptionModel_ToDomain.verified.txt
new file mode 100644
index 000000000..592844ad1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscriptionModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ Active: true,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscription_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscription_ToModel.verified.txt
new file mode 100644
index 000000000..0b962b977
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsLetterSubscription_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ Active: true,
+ Id: nls-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategoryModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategoryModel_ToDomain.verified.txt
new file mode 100644
index 000000000..154ded9eb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategoryModel_ToDomain.verified.txt
@@ -0,0 +1,11 @@
+{
+ Name: Tech Updates,
+ Description: Technology newsletter,
+ Selected: false,
+ DisplayOrder: 1,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategory_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategory_ToModel.verified.txt
new file mode 100644
index 000000000..757872f4f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.NewsletterCategory_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Tech Updates,
+ Description: Technology newsletter,
+ Selected: false,
+ DisplayOrder: 1,
+ Id: nlc-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployeeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployeeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..82aeba7f4
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployeeModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Alice Smith,
+ Active: true,
+ Commission: 5.0,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployee_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployee_ToModel.verified.txt
new file mode 100644
index 000000000..fa8e61339
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.SalesEmployee_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Alice Smith,
+ Active: true,
+ Commission: 5.0,
+ DisplayOrder: 1,
+ Id: se-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiCreateModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiCreateModel_ToDomain.verified.txt
new file mode 100644
index 000000000..c91921359
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiCreateModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Password: Secret123!,
+ IsActive: true,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5bd3ec495
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApiModel_ToDomain.verified.txt
@@ -0,0 +1,5 @@
+{
+ IsActive: true,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApi_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApi_ToModel.verified.txt
new file mode 100644
index 000000000..41063bd76
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.UserApi_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ IsActive: true,
+ Id: ua-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.cs
new file mode 100644
index 000000000..edf927c7c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/CustomerMappingTests.cs
@@ -0,0 +1,319 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Customers;
+using Grand.Domain.Messages;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Customers;
+using Grand.Web.AdminShared.Models.Messages;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class CustomerMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<CustomerGroupProfile>();
+ cfg.AddProfile<CustomerAttributeProfile>();
+ cfg.AddProfile<CustomerAttributeValueProfile>();
+ cfg.AddProfile<CustomerTagProfile>();
+ cfg.AddProfile<SalesEmployeeProfile>();
+ cfg.AddProfile<ContactAttributeProfile>();
+ cfg.AddProfile<ContactUsProfile>();
+ cfg.AddProfile<NewsLetterSubscriptionProfile>();
+ cfg.AddProfile<NewsletterCategoryProfile>();
+ cfg.AddProfile<UserApiProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── CustomerGroup ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerGroup_ToModel()
+ {
+ var source = new CustomerGroup {
+ Id = "cg-001",
+ Name = "VIP Customers",
+ FreeShipping = true,
+ TaxExempt = false,
+ Active = true,
+ IsSystem = false,
+ SystemName = "vip",
+ EnablePasswordLifetime = false
+ };
+ return Verify(_mapper.Map<CustomerGroupModel>(source));
+ }
+
+ [TestMethod]
+ public Task CustomerGroupModel_ToDomain()
+ {
+ var model = new CustomerGroupModel {
+ Name = "VIP Customers",
+ FreeShipping = true,
+ TaxExempt = false,
+ Active = true,
+ SystemName = "vip"
+ };
+ return Verify(_mapper.Map<CustomerGroup>(model));
+ }
+
+ // ── CustomerAttribute ─────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerAttribute_ToModel()
+ {
+ var source = new CustomerAttribute {
+ Id = "ca-001",
+ Name = "Newsletter Preference",
+ IsRequired = false,
+ AttributeControlTypeId = (AttributeControlType)2,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CustomerAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task CustomerAttributeModel_ToDomain()
+ {
+ var model = new CustomerAttributeModel {
+ Name = "Newsletter Preference",
+ IsRequired = false,
+ AttributeControlTypeId = 2,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CustomerAttribute>(model));
+ }
+
+ // ── CustomerAttributeValue ────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerAttributeValue_ToModel()
+ {
+ var source = new CustomerAttributeValue {
+ Id = "cav-001",
+ Name = "Weekly",
+ IsPreSelected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CustomerAttributeValueModel>(source));
+ }
+
+ [TestMethod]
+ public Task CustomerAttributeValueModel_ToDomain()
+ {
+ var model = new CustomerAttributeValueModel {
+ Name = "Weekly",
+ IsPreSelected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CustomerAttributeValue>(model));
+ }
+
+ // ── CustomerTag ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerTag_ToModel()
+ {
+ var source = new CustomerTag { Id = "ct-001", Name = "BigSpender" };
+ return Verify(_mapper.Map<CustomerTagModel>(source));
+ }
+
+ [TestMethod]
+ public Task CustomerTagModel_ToDomain()
+ {
+ var model = new CustomerTagModel { Name = "BigSpender" };
+ return Verify(_mapper.Map<CustomerTag>(model));
+ }
+
+ // ── SalesEmployee ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task SalesEmployee_ToModel()
+ {
+ var source = new SalesEmployee {
+ Id = "se-001",
+ Name = "Alice Smith",
+ Active = true,
+ Commission = 5.0,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<SalesEmployeeModel>(source));
+ }
+
+ [TestMethod]
+ public Task SalesEmployeeModel_ToDomain()
+ {
+ var model = new SalesEmployeeModel {
+ Name = "Alice Smith",
+ Active = true,
+ Commission = 5.0,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<SalesEmployee>(model));
+ }
+
+ // ── ContactAttribute ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ContactAttribute_ToModel()
+ {
+ var source = new ContactAttribute {
+ Id = "coa-001",
+ Name = "Preferred Contact",
+ TextPrompt = "How would you like to be contacted?",
+ IsRequired = false,
+ AttributeControlTypeId = 1,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ContactAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task ContactAttributeModel_ToDomain()
+ {
+ var model = new ContactAttributeModel {
+ Name = "Preferred Contact",
+ IsRequired = false,
+ AttributeControlTypeId = 1,
+ DisplayOrder = 1,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<ContactAttribute>(model));
+ }
+
+ // ── ContactAttributeValue ─────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ContactAttributeValue_ToModel()
+ {
+ var source = new ContactAttributeValue {
+ Id = "coav-001",
+ Name = "Email",
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ContactAttributeValueModel>(source));
+ }
+
+ [TestMethod]
+ public Task ContactAttributeValueModel_ToDomain()
+ {
+ var model = new ContactAttributeValueModel {
+ Name = "Email",
+ IsPreSelected = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ContactAttributeValue>(model));
+ }
+
+ // ── ContactUs ─────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ContactUs_ToModel()
+ {
+ var source = new ContactUs {
+ Id = "cu-001",
+ Email = "[email protected]",
+ FullName = "Jane Doe",
+ Subject = "Order inquiry",
+ Enquiry = "When will my order arrive?",
+ EmailAccountId = "ea-001",
+ StoreId = "store-001",
+ IpAddress = "192.168.1.1"
+ };
+ return Verify(_mapper.Map<ContactFormModel>(source));
+ }
+
+ // ── NewsLetterSubscription ────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task NewsLetterSubscription_ToModel()
+ {
+ var source = new NewsLetterSubscription {
+ Id = "nls-001",
+ Email = "[email protected]",
+ Active = true,
+ StoreId = "store-001"
+ };
+ return Verify(_mapper.Map<NewsLetterSubscriptionModel>(source));
+ }
+
+ [TestMethod]
+ public Task NewsLetterSubscriptionModel_ToDomain()
+ {
+ var model = new NewsLetterSubscriptionModel {
+ Email = "[email protected]",
+ Active = true
+ };
+ return Verify(_mapper.Map<NewsLetterSubscription>(model));
+ }
+
+ // ── NewsletterCategory ────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task NewsletterCategory_ToModel()
+ {
+ var source = new NewsletterCategory {
+ Id = "nlc-001",
+ Name = "Tech Updates",
+ Description = "Technology newsletter",
+ Selected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<NewsletterCategoryModel>(source));
+ }
+
+ [TestMethod]
+ public Task NewsletterCategoryModel_ToDomain()
+ {
+ var model = new NewsletterCategoryModel {
+ Name = "Tech Updates",
+ Description = "Technology newsletter",
+ DisplayOrder = 1,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<NewsletterCategory>(model));
+ }
+
+ // ── UserApi ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task UserApi_ToModel()
+ {
+ var source = new UserApi {
+ Id = "ua-001",
+ Email = "[email protected]",
+ IsActive = true
+ };
+ return Verify(_mapper.Map<UserApiModel>(source));
+ }
+
+ [TestMethod]
+ public Task UserApiModel_ToDomain()
+ {
+ var model = new UserApiModel {
+ Email = "[email protected]",
+ IsActive = true
+ };
+ return Verify(_mapper.Map<UserApi>(model));
+ }
+
+ [TestMethod]
+ public Task UserApiCreateModel_ToDomain()
+ {
+ var model = new UserApiCreateModel {
+ Email = "[email protected]",
+ Password = "Secret123!",
+ IsActive = true
+ };
+ return Verify(_mapper.Map<UserApi>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ExternalAuthenticationProvider_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ExternalAuthenticationProvider_ToModel.verified.txt
new file mode 100644
index 000000000..7b18bf274
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ExternalAuthenticationProvider_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ FriendlyName: Facebook authentication,
+ SystemName: ExternalAuth.Facebook,
+ IsActive: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PaymentProvider_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PaymentProvider_ToModel.verified.txt
new file mode 100644
index 000000000..4d84bc146
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PaymentProvider_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ FriendlyName: Cash on Delivery,
+ SystemName: Payments.CashOnDelivery,
+ DisplayOrder: 1,
+ IsActive: false,
+ SupportCapture: false,
+ SupportPartiallyRefund: false,
+ SupportRefund: false,
+ SupportVoid: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PluginInfo_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PluginInfo_ToModel.verified.txt
new file mode 100644
index 000000000..fc7b55cd2
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.PluginInfo_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Group: Widgets,
+ FriendlyName: Bootstrap Slider,
+ SystemName: Widgets.Slider,
+ Version: 2.1.2,
+ Author: grandnode team,
+ Installed: true
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ShippingRateCalculationProvider_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ShippingRateCalculationProvider_ToModel.verified.txt
new file mode 100644
index 000000000..5630488f4
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.ShippingRateCalculationProvider_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ FriendlyName: Fixed Rate Shipping,
+ SystemName: Shipping.FixedRate,
+ DisplayOrder: 5,
+ IsActive: false,
+ ConfigurationUrl: ../ShippingFixedRate/Configure
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.TaxProvider_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.TaxProvider_ToModel.verified.txt
new file mode 100644
index 000000000..4ace49482
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.TaxProvider_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ FriendlyName: Fixed Rate,
+ SystemName: Tax.FixedRate,
+ IsPrimaryTaxProvider: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.WidgetProvider_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.WidgetProvider_ToModel.verified.txt
new file mode 100644
index 000000000..882622a95
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.WidgetProvider_ToModel.verified.txt
@@ -0,0 +1,5 @@
+{
+ FriendlyName: Bootstrap Slider,
+ SystemName: Widgets.Slider,
+ IsActive: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.cs
new file mode 100644
index 000000000..7661e25fe
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ProviderMappingTests.cs
@@ -0,0 +1,122 @@
+using Grand.Mapping;
+using Grand.Business.Core.Interfaces.Authentication;
+using Grand.Business.Core.Interfaces.Catalog.Tax;
+using Grand.Business.Core.Interfaces.Checkout.Payments;
+using Grand.Business.Core.Interfaces.Checkout.Shipping;
+using Grand.Business.Core.Interfaces.Cms;
+using Grand.Infrastructure.Plugins;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Cms;
+using Grand.Web.AdminShared.Models.ExternalAuthentication;
+using Grand.Web.AdminShared.Models.Payments;
+using Grand.Web.AdminShared.Models.Plugins;
+using Grand.Web.AdminShared.Models.Shipping;
+using Grand.Web.AdminShared.Models.Tax;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class ProviderMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<PaymentMethodProfile>();
+ cfg.AddProfile<TaxProviderProfile>();
+ cfg.AddProfile<ShippingRateComputationMethodProfile>();
+ cfg.AddProfile<WidgetPluginProfile>();
+ cfg.AddProfile<ExternalAuthenticationMethodProfile>();
+ cfg.AddProfile<PluginDescriptorProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── PaymentMethod ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PaymentProvider_ToModel()
+ {
+ var mock = new Mock<IPaymentProvider>();
+ mock.Setup(x => x.FriendlyName).Returns("Cash on Delivery");
+ mock.Setup(x => x.SystemName).Returns("Payments.CashOnDelivery");
+ mock.Setup(x => x.Priority).Returns(1);
+
+ return Verify(_mapper.Map<IPaymentProvider, PaymentMethodModel>(mock.Object));
+ }
+
+ // ── TaxProvider ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task TaxProvider_ToModel()
+ {
+ var mock = new Mock<ITaxProvider>();
+ mock.Setup(x => x.FriendlyName).Returns("Fixed Rate");
+ mock.Setup(x => x.SystemName).Returns("Tax.FixedRate");
+
+ return Verify(_mapper.Map<ITaxProvider, TaxProviderModel>(mock.Object));
+ }
+
+ // ── ShippingRateComputationMethod ─────────────────────────────────────────
+
+ [TestMethod]
+ public Task ShippingRateCalculationProvider_ToModel()
+ {
+ var mock = new Mock<IShippingRateCalculationProvider>();
+ mock.Setup(x => x.FriendlyName).Returns("Fixed Rate Shipping");
+ mock.Setup(x => x.SystemName).Returns("Shipping.FixedRate");
+ mock.Setup(x => x.Priority).Returns(5);
+ mock.Setup(x => x.ConfigurationUrl).Returns("../ShippingFixedRate/Configure");
+
+ return Verify(_mapper.Map<IShippingRateCalculationProvider, ShippingRateComputationMethodModel>(mock.Object));
+ }
+
+ // ── WidgetPlugin ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task WidgetProvider_ToModel()
+ {
+ var mock = new Mock<IWidgetProvider>();
+ mock.Setup(x => x.FriendlyName).Returns("Bootstrap Slider");
+ mock.Setup(x => x.SystemName).Returns("Widgets.Slider");
+ mock.Setup(x => x.Priority).Returns(0);
+
+ return Verify(_mapper.Map<IWidgetProvider, WidgetModel>(mock.Object));
+ }
+
+ // ── ExternalAuthentication ────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ExternalAuthenticationProvider_ToModel()
+ {
+ var mock = new Mock<IExternalAuthenticationProvider>();
+ mock.Setup(x => x.FriendlyName).Returns("Facebook authentication");
+ mock.Setup(x => x.SystemName).Returns("ExternalAuth.Facebook");
+ mock.Setup(x => x.Priority).Returns(0);
+
+ return Verify(_mapper.Map<IExternalAuthenticationProvider, AuthenticationMethodModel>(mock.Object));
+ }
+
+ // ── PluginDescriptor ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PluginInfo_ToModel()
+ {
+ var pluginInfo = new PluginInfo {
+ FriendlyName = "Bootstrap Slider",
+ Group = "Widgets",
+ SystemName = "Widgets.Slider",
+ Version = "2.1.2",
+ Author = "grandnode team",
+ DisplayOrder = 0,
+ Installed = true
+ };
+
+ return Verify(_mapper.Map<PluginModel>(pluginInfo));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8fb753119
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,24 @@
+{
+ NameEnabled: true,
+ CompanyEnabled: true,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ StreetAddressEnabled: true,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: true,
+ StateProvinceEnabled: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ DisallowUsersToChangeEmail: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettings_ToModel.verified.txt
new file mode 100644
index 000000000..03b5eeb38
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AddressSettings_ToModel.verified.txt
@@ -0,0 +1,24 @@
+{
+ NameEnabled: true,
+ AddressTypeEnabled: false,
+ CompanyEnabled: true,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ StreetAddressEnabled: true,
+ StreetAddressRequired: true,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: true,
+ ZipPostalCodeRequired: true,
+ CityEnabled: true,
+ CityRequired: false,
+ CountryEnabled: true,
+ StateProvinceEnabled: true,
+ PhoneEnabled: true,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ DisallowUsersToChangeEmail: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..0e70817c9
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,13 @@
+{
+ SearchInProducts: true,
+ SearchInCategories: true,
+ SearchInCollections: false,
+ SearchInPages: false,
+ SearchInNews: false,
+ SearchInBlogs: false,
+ SearchInCustomers: false,
+ SearchInOrders: false,
+ MinSearchTermLength: 3,
+ MaxSearchResultsCount: 10,
+ SearchInMenu: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettings_ToModel.verified.txt
new file mode 100644
index 000000000..2bcd7439e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.AdminSearchSettings_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ SearchInProducts: true,
+ SearchInCategories: true,
+ SearchInCollections: false,
+ SearchInPages: true,
+ SearchInNews: false,
+ SearchInBlogs: true,
+ SearchInCustomers: true,
+ SearchInOrders: true,
+ MinSearchTermLength: 3,
+ MaxSearchResultsCount: 10,
+ SearchInMenu: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CaptchaSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CaptchaSettings_ToModel.verified.txt
new file mode 100644
index 000000000..046b57c3a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CaptchaSettings_ToModel.verified.txt
@@ -0,0 +1,19 @@
+{
+ CaptchaEnabled: true,
+ CaptchaShowOnLoginPage: true,
+ CaptchaShowOnRegistrationPage: false,
+ CaptchaShowOnPasswordRecoveryPage: false,
+ CaptchaShowOnContactUsPage: true,
+ CaptchaShowOnEmailWishlistToFriendPage: false,
+ CaptchaShowOnEmailProductToFriendPage: false,
+ CaptchaShowOnAskQuestionPage: false,
+ CaptchaShowOnBlogCommentPage: false,
+ CaptchaShowOnArticleCommentPage: false,
+ CaptchaShowOnNewsCommentPage: false,
+ CaptchaShowOnProductReviewPage: false,
+ CaptchaShowOnApplyVendorPage: false,
+ CaptchaShowOnVendorReviewPage: false,
+ ReCaptchaPublicKey: public-key-123,
+ ReCaptchaPrivateKey: private-key-456,
+ ReCaptchaVersion: V2
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8116485f5
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,57 @@
+{
+ AllowViewUnpublishedProductPage: false,
+ DisplayDiscontinuedMessageForUnpublishedProducts: false,
+ PublishBackProductWhenCancellingOrders: false,
+ ShowSkuOnProductDetailsPage: true,
+ ShowSkuOnCatalogPages: false,
+ ShowSpecAttributeOnCatalogPages: false,
+ SecondPictureOnCatalogPages: false,
+ ShowMpn: false,
+ ShowGtin: false,
+ ShowFreeShippingNotification: false,
+ AllowProductSorting: false,
+ AllowProductViewModeChanging: false,
+ ShowProductsFromSubcategories: false,
+ ShowProductsFromSubcategoriesInSearchBox: false,
+ ShowCategoryProductNumber: false,
+ ShowCategoryProductNumberIncludingSubcategories: false,
+ CategoryBreadcrumbEnabled: false,
+ ShowShareButton: false,
+ ProductReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewProduct: false,
+ NotifyStoreOwnerAboutNewProductReviews: false,
+ EmailAFriendEnabled: false,
+ AskQuestionOnProduct: false,
+ AllowAnonymousUsersToEmailAFriend: false,
+ ProductReviewPossibleOnlyAfterPurchasing: false,
+ ProductReviewPossibleOnlyOnce: false,
+ RecentlyViewedProductsEnabled: false,
+ RecommendedProductsEnabled: false,
+ SuggestedProductsEnabled: false,
+ PersonalizedProductsEnabled: false,
+ NewProductsEnabled: false,
+ NewProductsOnHomePage: false,
+ CompareProductsEnabled: false,
+ ProductSearchAutoCompleteEnabled: false,
+ SearchBySku: false,
+ SearchByDescription: false,
+ ShowProductImagesInSearchAutoComplete: false,
+ SaveSearchAutoComplete: false,
+ ShowBestsellersOnHomepage: false,
+ BestsellersFromReports: false,
+ SearchPageProductsPerPage: 6,
+ SearchPageAllowCustomersToSelectPageSize: false,
+ ProductsAlsoPurchasedEnabled: false,
+ ProductsByTagAllowCustomersToSelectPageSize: false,
+ IncludeShortDescriptionInCompareProducts: false,
+ IncludeFullDescriptionInCompareProducts: false,
+ IncludeFeaturedProductsInNormalLists: false,
+ DisplayTierPricesWithDiscounts: false,
+ IgnoreDiscounts: false,
+ IgnoreFeaturedProducts: false,
+ CustomerProductPrice: false,
+ IgnoreFilterableSpecAttributeOption: false,
+ IgnoreFilterableAvailableStartEndDateTime: false,
+ DisplayQuantityOnCatalogPages: false,
+ SortingByAvailability: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettings_ToModel.verified.txt
new file mode 100644
index 000000000..ece1c7786
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CatalogSettings_ToModel.verified.txt
@@ -0,0 +1,74 @@
+{
+ AllowViewUnpublishedProductPage: false,
+ DisplayDiscontinuedMessageForUnpublishedProducts: true,
+ ShowSkuOnProductDetailsPage: true,
+ ShowSkuOnCatalogPages: false,
+ ShowMpn: false,
+ ShowGtin: false,
+ ShowFreeShippingNotification: true,
+ AllowProductSorting: false,
+ AllowProductViewModeChanging: false,
+ ShowProductsFromSubcategories: false,
+ ShowCategoryProductNumber: false,
+ ShowCategoryProductNumberIncludingSubcategories: false,
+ CategoryBreadcrumbEnabled: false,
+ ShowShareButton: false,
+ PageShareCode: ,
+ ProductReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewProduct: false,
+ ProductReviewPossibleOnlyAfterPurchasing: false,
+ ProductReviewPossibleOnlyOnce: false,
+ NotifyStoreOwnerAboutNewProductReviews: false,
+ EmailAFriendEnabled: false,
+ AskQuestionOnProduct: false,
+ AllowAnonymousUsersToEmailAFriend: false,
+ RecentlyViewedProductsEnabled: false,
+ RecommendedProductsEnabled: false,
+ SuggestedProductsEnabled: false,
+ PersonalizedProductsEnabled: false,
+ NewProductsEnabled: false,
+ NewProductsOnHomePage: false,
+ CompareProductsEnabled: false,
+ ShowBestsellersOnHomepage: false,
+ BestsellersFromReports: false,
+ SearchPageProductsPerPage: 6,
+ SearchPageAllowCustomersToSelectPageSize: true,
+ ProductSearchAutoCompleteEnabled: false,
+ ShowProductImagesInSearchAutoComplete: false,
+ ProductsAlsoPurchasedEnabled: false,
+ ProductsByTagAllowCustomersToSelectPageSize: false,
+ IncludeShortDescriptionInCompareProducts: false,
+ IncludeFullDescriptionInCompareProducts: false,
+ IgnoreDiscounts: false,
+ IgnoreFeaturedProducts: false,
+ IgnoreFilterableSpecAttributeOption: false,
+ IgnoreFilterableAvailableStartEndDateTime: false,
+ CustomerProductPrice: false,
+ ShowSpecAttributeOnCatalogPages: false,
+ SecondPictureOnCatalogPages: false,
+ SearchBySku: false,
+ SearchByDescription: false,
+ SaveSearchAutoComplete: false,
+ IncludeFeaturedProductsInNormalLists: false,
+ DisplayTierPricesWithDiscounts: false,
+ DisplayQuantityOnCatalogPages: false,
+ SortingByAvailability: false,
+ DefaultViewModes: [
+ {
+ Disabled: false,
+ Selected: false,
+ Text: grid,
+ Value: grid
+ },
+ {
+ Disabled: false,
+ Selected: false,
+ Text: list,
+ Value: list
+ }
+ ],
+ DefaultPageSizeOptions: 6, 3, 9,
+ MaxCatalogPageSize: 10,
+ ShowProductsFromSubcategoriesInSearchBox: false,
+ PublishBackProductWhenCancellingOrders: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..b6560a33d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,13 @@
+{
+ StoreInDatabaseContactUsForm: true,
+ SubjectFieldOnContactUsForm: false,
+ UseSystemEmailForContactUsForm: false,
+ SitemapEnabled: true,
+ SitemapIncludeCategories: false,
+ SitemapIncludeBrands: false,
+ SitemapIncludeProducts: false,
+ SitemapIncludeImage: false,
+ PopupForTermsOfServiceLinks: false,
+ AllowToSelectStore: false,
+ AllowEditProductEndedAuction: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettings_ToModel.verified.txt
new file mode 100644
index 000000000..b2131de4e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CommonSettings_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ StoreInDatabaseContactUsForm: true,
+ SubjectFieldOnContactUsForm: false,
+ UseSystemEmailForContactUsForm: false,
+ AllowToSelectStore: false,
+ PopupForTermsOfServiceLinks: true,
+ SitemapEnabled: true,
+ SitemapIncludeCategories: true,
+ SitemapIncludeImage: false,
+ SitemapIncludeBrands: false,
+ SitemapIncludeProducts: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..90d3c60d1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,50 @@
+{
+ UsernamesEnabled: false,
+ CheckUsernameAvailabilityEnabled: false,
+ AllowUsersToChangeUsernames: false,
+ AllowUsersToChangeEmail: false,
+ FirstLastNameRequired: false,
+ DefaultPasswordFormat: Hashed,
+ NotifyNewCustomerRegistration: false,
+ HideDownloadableProductsTab: false,
+ HideOutOfStockSubscriptionsTab: false,
+ HideAuctionsTab: false,
+ HideNotesTab: false,
+ HideDocumentsTab: false,
+ HideSubAccountsTab: false,
+ DownloadableProductsValidateUser: false,
+ NewsletterEnabled: false,
+ NewsletterTickedByDefault: false,
+ HideNewsletterBlock: false,
+ NewsletterBlockAllowToUnsubscribe: false,
+ StoreLastVisitedPage: false,
+ RegistrationFreeShipping: false,
+ AllowUsersToDeleteAccount: false,
+ AllowUsersToExportData: false,
+ HideReviewsTab: false,
+ HideCoursesTab: false,
+ TwoFactorAuthenticationEnabled: false,
+ GeoEnabled: false,
+ GenderEnabled: false,
+ DateOfBirthEnabled: false,
+ DateOfBirthRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: false,
+ CountryRequired: false,
+ StateProvinceEnabled: false,
+ StateProvinceRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ AcceptPrivacyPolicyEnabled: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettings_ToModel.verified.txt
new file mode 100644
index 000000000..5ec100ff2
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.CustomerSettings_ToModel.verified.txt
@@ -0,0 +1,48 @@
+{
+ FirstLastNameRequired: false,
+ AllowUsersToChangeEmail: false,
+ UsernamesEnabled: false,
+ AllowUsersToChangeUsernames: true,
+ CheckUsernameAvailabilityEnabled: false,
+ GeoEnabled: false,
+ NotifyNewCustomerRegistration: true,
+ HideDownloadableProductsTab: false,
+ HideOutOfStockSubscriptionsTab: false,
+ HideAuctionsTab: false,
+ HideNotesTab: false,
+ AllowUsersToDeleteAccount: false,
+ AllowUsersToExportData: false,
+ NewsletterEnabled: true,
+ NewsletterTickedByDefault: false,
+ HideNewsletterBlock: false,
+ NewsletterBlockAllowToUnsubscribe: false,
+ RegistrationFreeShipping: false,
+ StoreLastVisitedPage: false,
+ GenderEnabled: false,
+ DateOfBirthEnabled: false,
+ DateOfBirthRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: false,
+ CountryRequired: false,
+ StateProvinceEnabled: false,
+ StateProvinceRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ AcceptPrivacyPolicyEnabled: false,
+ HideReviewsTab: false,
+ HideCoursesTab: false,
+ TwoFactorAuthenticationEnabled: false,
+ HideSubaccountsTab: false,
+ HideDocumentsTab: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..64352088c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,8 @@
+{
+ Enabled: true,
+ ExchangeRate: 0.01,
+ PointsForRegistration: 100,
+ ReduceLoyaltyPointsAfterCancelOrder: false,
+ DisplayHowMuchWillBeEarned: false,
+ PointsAccumulatedForAllStores: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettings_ToModel.verified.txt
new file mode 100644
index 000000000..e1e0cf82d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.LoyaltyPointsSettings_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ Enabled: true,
+ ExchangeRate: 0.01,
+ PointsForRegistration: 100,
+ PointsForPurchases_Amount: 10.0,
+ PointsForPurchases_Points: 1,
+ ReduceLoyaltyPointsAfterCancelOrder: false,
+ DisplayHowMuchWillBeEarned: false,
+ PointsAccumulatedForAllStores: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..4928d8549
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ DefaultImageName: no-image.png,
+ ProductThumbPictureSize: 415,
+ DefaultPictureZoomEnabled: false,
+ MaximumImageSize: 1980
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettings_ToModel.verified.txt
new file mode 100644
index 000000000..1af9b11e2
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.MediaSettings_ToModel.verified.txt
@@ -0,0 +1,18 @@
+{
+ ProductThumbPictureSize: 415,
+ ProductDetailsPictureSize: 550,
+ ProductThumbPictureSizeOnProductDetailsPage: 100,
+ AssociatedProductPictureSize: 220,
+ CategoryThumbPictureSize: 450,
+ BrandThumbPictureSize: 450,
+ CollectionThumbPictureSize: 450,
+ VendorThumbPictureSize: 450,
+ CartThumbPictureSize: 80,
+ MaximumImageSize: 1980,
+ ImageQuality: 100,
+ DefaultPictureZoomEnabled: false,
+ AutoCompleteSearchThumbPictureSize: 20,
+ FileManagerEnabledCommands: abort,open,file,mkdir,mkfile,parents,tmb,dim,paste,duplicate,get,rm,ls,put,size,rename,tree,resize,search,upload,
+ FileManagerDisabledUICommands: ping,hide,archive,extract,netmount,netunmount,zipdl,
+ DefaultImageName: no-image.png
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..109a0bfd8
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,23 @@
+{
+ IsReOrderAllowed: true,
+ MinOrderSubtotalAmountIncludingTax: false,
+ AnonymousCheckoutAllowed: true,
+ TermsOfServiceOnShoppingCartPage: false,
+ TermsOfServiceOnOrderConfirmPage: false,
+ DisableOrderCompletedPage: false,
+ AttachPdfInvoiceToOrderPlacedEmail: false,
+ AttachPdfInvoiceToOrderPaidEmail: false,
+ AttachPdfInvoiceToOrderCompletedEmail: false,
+ AttachPdfInvoiceToBinary: false,
+ MerchandiseReturnsEnabled: false,
+ MerchandiseReturns_AllowToSpecifyPickupAddress: false,
+ MerchandiseReturns_AllowToSpecifyPickupDate: false,
+ MerchandiseReturns_PickupDateRequired: false,
+ DeactivateGiftVouchersAfterCancelOrder: false,
+ DeactivateGiftVouchersAfterDeletingOrder: false,
+ GiftVouchers_Assign_StoreId: false,
+ CompleteOrderWhenDelivered: false,
+ UserCanCancelUnpaidOrder: false,
+ UnpublishAuctionProduct: false,
+ AllowCustomerToAddOrderNote: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettings_ToModel.verified.txt
new file mode 100644
index 000000000..a049c0e21
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.OrderSettings_ToModel.verified.txt
@@ -0,0 +1,24 @@
+{
+ IsReOrderAllowed: true,
+ MinOrderSubtotalAmountIncludingTax: false,
+ AnonymousCheckoutAllowed: true,
+ TermsOfServiceOnShoppingCartPage: true,
+ TermsOfServiceOnOrderConfirmPage: false,
+ DisableOrderCompletedPage: false,
+ AttachPdfInvoiceToOrderPlacedEmail: false,
+ AttachPdfInvoiceToOrderPaidEmail: false,
+ AttachPdfInvoiceToOrderCompletedEmail: false,
+ MerchandiseReturnsEnabled: false,
+ MerchandiseReturns_AllowToSpecifyPickupAddress: false,
+ MerchandiseReturns_AllowToSpecifyPickupDate: false,
+ GiftVouchers_Activated_OrderStatusId: 30,
+ DeactivateGiftVouchersAfterCancelOrder: false,
+ DeactivateGiftVouchersAfterDeletingOrder: false,
+ GiftVouchers_Assign_StoreId: false,
+ CompleteOrderWhenDelivered: false,
+ UserCanCancelUnpaidOrder: false,
+ AllowCustomerToAddOrderNote: false,
+ AttachPdfInvoiceToBinary: false,
+ MerchandiseReturns_PickupDateRequired: false,
+ UnpublishAuctionProduct: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..a1bb5b191
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,4 @@
+{
+ Enabled: false,
+ AllowGuestNotifications: true
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettings_ToModel.verified.txt
new file mode 100644
index 000000000..25f4aed56
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.PushNotificationsSettings_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ Enabled: false,
+ PushApiKey: ,
+ SenderId: ,
+ AuthDomain: ,
+ DatabaseUrl: ,
+ ProjectId: ,
+ StorageBucket: ,
+ AppId: ,
+ AllowGuestNotifications: true
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SecuritySettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SecuritySettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..7b31b2539
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SecuritySettingsModel_ToDomain.verified.txt
@@ -0,0 +1,18 @@
+{
+ Enabled: true,
+ ShowOnLoginPage: true,
+ ShowOnRegistrationPage: false,
+ ShowOnPasswordRecoveryPage: false,
+ ShowOnContactUsPage: false,
+ ShowOnEmailWishlistToFriendPage: false,
+ ShowOnEmailProductToFriendPage: false,
+ ShowOnAskQuestionPage: false,
+ ShowOnBlogCommentPage: false,
+ ShowOnArticleCommentPage: false,
+ ShowOnNewsCommentPage: false,
+ ShowOnProductReviewPage: false,
+ ShowOnApplyVendorPage: false,
+ ShowOnVendorReviewPage: false,
+ ReCaptchaPublicKey: public-key-123,
+ ReCaptchaPrivateKey: private-key-456
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..e7397e384
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,12 @@
+{
+ PageTitleSeparator: | ,
+ PageTitleSeoAdjustment: false,
+ DefaultTitle: Grand Store,
+ GenerateProductMetaDescription: false,
+ ConvertNonWesternChars: false,
+ AllowSlashChar: false,
+ AllowUnicodeCharsInUrls: true,
+ CanonicalUrlsEnabled: false,
+ TwitterMetaTags: false,
+ OpenGraphMetaTags: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettings_ToModel.verified.txt
new file mode 100644
index 000000000..e52ac8e96
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.SeoSettings_ToModel.verified.txt
@@ -0,0 +1,14 @@
+{
+ PageTitleSeparator: | ,
+ PageTitleSeoAdjustment: true,
+ DefaultTitle: Grand Store,
+ DefaultMetaKeywords: store, online,
+ DefaultMetaDescription: Best online store,
+ GenerateProductMetaDescription: true,
+ ConvertNonWesternChars: false,
+ CanonicalUrlsEnabled: false,
+ TwitterMetaTags: false,
+ OpenGraphMetaTags: false,
+ AllowSlashChar: false,
+ AllowUnicodeCharsInUrls: true
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..2ce62b74a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,21 @@
+{
+ DisplayCartAfterAddingProduct: true,
+ DisplayWishlistAfterAddingProduct: false,
+ MaximumShoppingCartItems: 1000,
+ AllowOutOfStockItemsToBeAddedToWishlist: false,
+ MoveItemsFromWishlistToCart: false,
+ ShowProductImagesOnShoppingCart: false,
+ ShowProductImagesOnWishList: false,
+ ShowDiscountBox: true,
+ ShowGiftVoucherBox: false,
+ EmailWishlistEnabled: false,
+ AllowAnonymousUsersToEmailWishlist: false,
+ MiniShoppingCartEnabled: false,
+ ShowImagesInsidebarCart: false,
+ RoundPrices: false,
+ GroupTierPrices: false,
+ AllowCartItemEditing: false,
+ AllowOnHoldCart: false,
+ SharedCartBetweenStores: false,
+ AllowToSelectWarehouse: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettings_ToModel.verified.txt
new file mode 100644
index 000000000..aa04e7d0f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.ShoppingCartSettings_ToModel.verified.txt
@@ -0,0 +1,23 @@
+{
+ DisplayCartAfterAddingProduct: true,
+ DisplayWishlistAfterAddingProduct: false,
+ MaximumShoppingCartItems: 1000,
+ MaximumWishlistItems: 1000,
+ AllowOutOfStockItemsToBeAddedToWishlist: true,
+ MoveItemsFromWishlistToCart: true,
+ ShowProductImagesOnShoppingCart: true,
+ ShowProductImagesOnWishList: true,
+ ShowDiscountBox: true,
+ ShowGiftVoucherBox: true,
+ CrossSellsNumber: 4,
+ EmailWishlistEnabled: true,
+ AllowAnonymousUsersToEmailWishlist: false,
+ MiniShoppingCartEnabled: false,
+ ShowImagesInsidebarCart: false,
+ AllowCartItemEditing: false,
+ SharedCartBetweenStores: false,
+ AllowOnHoldCart: false,
+ AllowToSelectWarehouse: false,
+ GroupTierPrices: false,
+ RoundPrices: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..5fa3de0c1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,21 @@
+{
+ TaxDisplayType: 1,
+ DefaultTaxAddress: {
+ Id: ObjectId_1
+ },
+ DisplayTaxRates: false,
+ PricesIncludeTax: false,
+ AllowCustomersToSelectTaxDisplayType: false,
+ HideZeroTax: false,
+ HideTaxInOrderSummary: false,
+ ForceTaxExclusionFromOrderSubtotal: false,
+ ShippingIsTaxable: false,
+ ShippingPriceIncludesTax: false,
+ PaymentMethodAdditionalFeeIsTaxable: false,
+ PaymentMethodAdditionalFeeIncludesTax: false,
+ EuVatEnabled: false,
+ EuVatAllowVatExemption: false,
+ EuVatUseWebService: false,
+ EuVatAssumeValid: false,
+ CalculateRoundPrice: 2
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettings_ToModel.verified.txt
new file mode 100644
index 000000000..f4cefef8c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.TaxSettings_ToModel.verified.txt
@@ -0,0 +1,48 @@
+{
+ PricesIncludeTax: false,
+ AllowCustomersToSelectTaxDisplayType: true,
+ TaxDisplayType: 10,
+ DisplayTaxRates: false,
+ HideZeroTax: false,
+ HideTaxInOrderSummary: false,
+ ForceTaxExclusionFromOrderSubtotal: false,
+ DefaultTaxAddress: {
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false
+ },
+ ShippingIsTaxable: false,
+ ShippingPriceIncludesTax: false,
+ PaymentMethodAdditionalFeeIsTaxable: false,
+ PaymentMethodAdditionalFeeIncludesTax: false,
+ EuVatEnabled: false,
+ EuVatShopCountryId: ,
+ EuVatAllowVatExemption: true,
+ EuVatUseWebService: false,
+ EuVatAssumeValid: false,
+ CalculateRoundPrice: 2
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.cs
new file mode 100644
index 000000000..137bb0802
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SettingsMappingTests.cs
@@ -0,0 +1,452 @@
+using Grand.Mapping;
+using Grand.Domain.Admin;
+using Grand.Domain.Blogs;
+using Grand.Domain.Catalog;
+using Grand.Domain.Common;
+using Grand.Domain.Customers;
+using Grand.Domain.Knowledgebase;
+using Grand.Domain.Media;
+using Grand.Domain.News;
+using Grand.Domain.Orders;
+using Grand.Domain.Payments;
+using Grand.Domain.PushNotifications;
+using Grand.Domain.Seo;
+using Grand.Domain.Shipping;
+using Grand.Domain.Tax;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Settings;
+using Grand.Web.AdminShared.Models.Tax;
+using Grand.Web.Common.Security.Captcha;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class SettingsMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<CatalogSettingsProfile>();
+ cfg.AddProfile<MediaSettingsProfile>();
+ cfg.AddProfile<CommonSettingsProfile>();
+ cfg.AddProfile<CaptchaSettingsProfile>();
+ cfg.AddProfile<SeoSettingsProfile>();
+ cfg.AddProfile<StoreInformationSettingsProfile>();
+ cfg.AddProfile<PdfSettingsProfile>();
+ cfg.AddProfile<MenuItemSettingsProfile>();
+ cfg.AddProfile<AdminSearchSettingsProfile>();
+ cfg.AddProfile<ShoppingCartSettingsProfile>();
+ cfg.AddProfile<LoyaltyPointsSettingsProfile>();
+ cfg.AddProfile<OrderSettingsProfile>();
+ cfg.AddProfile<TaxSettingsProfile>();
+ cfg.AddProfile<AddressProfile>();
+ cfg.AddProfile<PushNotificationsSettingsProfile>();
+ cfg.AddProfile<CustomerSettingsProfile>();
+ cfg.AddProfile<AddressSettingsProfile>();
+ cfg.AddProfile<BlogSettingsProfile>();
+ cfg.AddProfile<NewsSettingsProfile>();
+ cfg.AddProfile<KnowledgebaseSettingsProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── CatalogSettings ───────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CatalogSettings_ToModel()
+ {
+ var source = new CatalogSettings {
+ AllowViewUnpublishedProductPage = false,
+ DisplayDiscontinuedMessageForUnpublishedProducts = true,
+ ShowSkuOnProductDetailsPage = true,
+ ShowSkuOnCatalogPages = false,
+ ShowGtin = false,
+ ShowFreeShippingNotification = true,
+ ShowProductImagesInSearchAutoComplete = false,
+ PageShareCode = "",
+ DefaultPageSizeOptions = "6, 3, 9",
+ SearchPageProductsPerPage = 6,
+ SearchPageAllowCustomersToSelectPageSize = true
+ };
+ return Verify(_mapper.Map<CatalogSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task CatalogSettingsModel_ToDomain()
+ {
+ var model = new CatalogSettingsModel {
+ AllowViewUnpublishedProductPage = false,
+ ShowSkuOnProductDetailsPage = true,
+ SearchPageProductsPerPage = 6
+ };
+ return Verify(_mapper.Map<CatalogSettings>(model));
+ }
+
+ // ── MediaSettings ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MediaSettings_ToModel()
+ {
+ var source = new MediaSettings {
+ ProductThumbPictureSize = 415,
+ ProductDetailsPictureSize = 550,
+ ProductThumbPictureSizeOnProductDetailsPage = 100,
+ AssociatedProductPictureSize = 220,
+ CategoryThumbPictureSize = 450,
+ CollectionThumbPictureSize = 450,
+ BrandThumbPictureSize = 450,
+ VendorThumbPictureSize = 450,
+ CartThumbPictureSize = 80,
+ MaximumImageSize = 1980,
+ AutoCompleteSearchThumbPictureSize = 20
+ };
+ return Verify(_mapper.Map<MediaSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task MediaSettingsModel_ToDomain()
+ {
+ var model = new MediaSettingsModel {
+ ProductThumbPictureSize = 415,
+ MaximumImageSize = 1980
+ };
+ return Verify(_mapper.Map<MediaSettings>(model));
+ }
+
+ // ── CommonSettings ────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CommonSettings_ToModel()
+ {
+ var source = new CommonSettings {
+ StoreInDatabaseContactUsForm = true,
+ UseSystemEmailForContactUsForm = false,
+ SitemapEnabled = true,
+ SitemapIncludeCategories = true,
+ SitemapIncludeProducts = false,
+ PopupForTermsOfServiceLinks = true
+ };
+ return Verify(_mapper.Map<GeneralCommonSettingsModel.CommonSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task CommonSettingsModel_ToDomain()
+ {
+ var model = new GeneralCommonSettingsModel.CommonSettingsModel {
+ StoreInDatabaseContactUsForm = true,
+ SitemapEnabled = true
+ };
+ return Verify(_mapper.Map<CommonSettings>(model));
+ }
+
+ // ── CaptchaSettings ───────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CaptchaSettings_ToModel()
+ {
+ var source = new CaptchaSettings {
+ Enabled = true,
+ ShowOnLoginPage = true,
+ ShowOnRegistrationPage = false,
+ ShowOnContactUsPage = true,
+ ShowOnProductReviewPage = false,
+ ReCaptchaPublicKey = "public-key-123",
+ ReCaptchaPrivateKey = "private-key-456",
+ ReCaptchaVersion = GoogleReCaptchaVersion.V2
+ };
+ return Verify(_mapper.Map<GeneralCommonSettingsModel.SecuritySettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task SecuritySettingsModel_ToDomain()
+ {
+ var model = new GeneralCommonSettingsModel.SecuritySettingsModel {
+ CaptchaEnabled = true,
+ CaptchaShowOnLoginPage = true,
+ ReCaptchaPublicKey = "public-key-123",
+ ReCaptchaPrivateKey = "private-key-456"
+ };
+ return Verify(_mapper.Map<CaptchaSettings>(model));
+ }
+
+ // ── SeoSettings ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task SeoSettings_ToModel()
+ {
+ var source = new SeoSettings {
+ PageTitleSeparator = " | ",
+ PageTitleSeoAdjustment = true,
+ DefaultTitle = "Grand Store",
+ DefaultMetaKeywords = "store, online",
+ DefaultMetaDescription = "Best online store",
+ GenerateProductMetaDescription = true,
+ ConvertNonWesternChars = false,
+ AllowUnicodeCharsInUrls = true,
+ CanonicalUrlsEnabled = false
+ };
+ return Verify(_mapper.Map<GeneralCommonSettingsModel.SeoSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task SeoSettingsModel_ToDomain()
+ {
+ var model = new GeneralCommonSettingsModel.SeoSettingsModel {
+ PageTitleSeparator = " | ",
+ DefaultTitle = "Grand Store",
+ AllowUnicodeCharsInUrls = true
+ };
+ return Verify(_mapper.Map<SeoSettings>(model));
+ }
+
+ // ── AdminSearchSettings ───────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AdminSearchSettings_ToModel()
+ {
+ var source = new AdminSearchSettings {
+ SearchInProducts = true,
+ SearchInCategories = true,
+ SearchInBlogs = true,
+ SearchInOrders = true,
+ SearchInCustomers = true,
+ SearchInNews = false,
+ SearchInPages = true,
+ MinSearchTermLength = 3,
+ MaxSearchResultsCount = 10
+ };
+ return Verify(_mapper.Map<AdminSearchSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task AdminSearchSettingsModel_ToDomain()
+ {
+ var model = new AdminSearchSettingsModel {
+ SearchInProducts = true,
+ SearchInCategories = true,
+ MinSearchTermLength = 3,
+ MaxSearchResultsCount = 10
+ };
+ return Verify(_mapper.Map<AdminSearchSettings>(model));
+ }
+
+ // ── ShoppingCartSettings ──────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ShoppingCartSettings_ToModel()
+ {
+ var source = new ShoppingCartSettings {
+ DisplayCartAfterAddingProduct = true,
+ DisplayWishlistAfterAddingProduct = false,
+ MaximumShoppingCartItems = 1000,
+ MaximumWishlistItems = 1000,
+ AllowOutOfStockItemsToBeAddedToWishlist = true,
+ MoveItemsFromWishlistToCart = true,
+ ShowProductImagesOnShoppingCart = true,
+ ShowProductImagesOnWishList = true,
+ ShowDiscountBox = true,
+ ShowGiftVoucherBox = true,
+ CrossSellsNumber = 4,
+ EmailWishlistEnabled = true,
+ AllowAnonymousUsersToEmailWishlist = false
+ };
+ return Verify(_mapper.Map<SalesSettingsModel.ShoppingCartSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task ShoppingCartSettingsModel_ToDomain()
+ {
+ var model = new SalesSettingsModel.ShoppingCartSettingsModel {
+ DisplayCartAfterAddingProduct = true,
+ MaximumShoppingCartItems = 1000,
+ ShowDiscountBox = true
+ };
+ return Verify(_mapper.Map<ShoppingCartSettings>(model));
+ }
+
+ // ── LoyaltyPointsSettings ─────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task LoyaltyPointsSettings_ToModel()
+ {
+ var source = new LoyaltyPointsSettings {
+ Enabled = true,
+ ExchangeRate = 0.01,
+ MinimumLoyaltyPointsToUse = 0,
+ PointsForRegistration = 100,
+ PointsForPurchases_Amount = 10,
+ PointsForPurchases_Points = 1
+ };
+ return Verify(_mapper.Map<SalesSettingsModel.LoyaltyPointsSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task LoyaltyPointsSettingsModel_ToDomain()
+ {
+ var model = new SalesSettingsModel.LoyaltyPointsSettingsModel {
+ Enabled = true,
+ ExchangeRate = 0.01,
+ PointsForRegistration = 100
+ };
+ return Verify(_mapper.Map<LoyaltyPointsSettings>(model));
+ }
+
+ // ── OrderSettings ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task OrderSettings_ToModel()
+ {
+ var source = new OrderSettings {
+ IsReOrderAllowed = true,
+ MinOrderSubtotalAmount = 0,
+ MinOrderSubtotalAmountIncludingTax = false,
+ MinOrderTotalAmount = 0,
+ AnonymousCheckoutAllowed = true,
+ TermsOfServiceOnShoppingCartPage = true,
+ TermsOfServiceOnOrderConfirmPage = false,
+ GiftVouchers_Activated_OrderStatusId = 30
+ };
+ return Verify(_mapper.Map<SalesSettingsModel.OrderSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task OrderSettingsModel_ToDomain()
+ {
+ var model = new SalesSettingsModel.OrderSettingsModel {
+ IsReOrderAllowed = true,
+ AnonymousCheckoutAllowed = true
+ };
+ return Verify(_mapper.Map<OrderSettings>(model));
+ }
+
+ // ── TaxSettings ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task TaxSettings_ToModel()
+ {
+ var source = new TaxSettings {
+ PricesIncludeTax = false,
+ AllowCustomersToSelectTaxDisplayType = true,
+ TaxDisplayType = TaxDisplayType.ExcludingTax,
+ DisplayTaxRates = false,
+ HideZeroTax = false,
+ HideTaxInOrderSummary = false,
+ ForceTaxExclusionFromOrderSubtotal = false,
+ ShippingIsTaxable = false,
+ EuVatEnabled = false,
+ EuVatShopCountryId = "",
+ EuVatAllowVatExemption = true,
+ EuVatUseWebService = false
+ };
+ return Verify(_mapper.Map<TaxSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task TaxSettingsModel_ToDomain()
+ {
+ var model = new TaxSettingsModel {
+ PricesIncludeTax = false,
+ TaxDisplayType = 1,
+ EuVatEnabled = false
+ };
+ return Verify(_mapper.Map<TaxSettings>(model));
+ }
+
+ // ── PushNotificationsSettings ─────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PushNotificationsSettings_ToModel()
+ {
+ var source = new PushNotificationsSettings {
+ Enabled = false,
+ AllowGuestNotifications = true,
+ AuthDomain = "",
+ DatabaseUrl = "",
+ ProjectId = "",
+ PublicApiKey = "",
+ SenderId = "",
+ StorageBucket = "",
+ AppId = ""
+ };
+ return Verify(_mapper.Map<PushNotificationsSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task PushNotificationsSettingsModel_ToDomain()
+ {
+ var model = new PushNotificationsSettingsModel {
+ Enabled = false,
+ AllowGuestNotifications = true
+ };
+ return Verify(_mapper.Map<PushNotificationsSettings>(model));
+ }
+
+ // ── CustomerSettings ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerSettings_ToModel()
+ {
+ var source = new CustomerSettings {
+ UsernamesEnabled = false,
+ CheckUsernameAvailabilityEnabled = false,
+ AllowUsersToChangeUsernames = true,
+ NotifyNewCustomerRegistration = true,
+ NewsletterEnabled = true,
+ GeoEnabled = false
+ };
+ return Verify(_mapper.Map<CustomerSettingsModel.CustomersSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task CustomerSettingsModel_ToDomain()
+ {
+ var model = new CustomerSettingsModel.CustomersSettingsModel {
+ UsernamesEnabled = false,
+ DefaultPasswordFormat = 1
+ };
+ return Verify(_mapper.Map<CustomerSettings>(model));
+ }
+
+ // ── AddressSettings ───────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AddressSettings_ToModel()
+ {
+ var source = new AddressSettings {
+ NameEnabled = true,
+ CompanyEnabled = true,
+ CompanyRequired = false,
+ CountryEnabled = true,
+ StateProvinceEnabled = true,
+ CityEnabled = true,
+ CityRequired = false,
+ StreetAddressEnabled = true,
+ StreetAddressRequired = true,
+ StreetAddress2Enabled = false,
+ ZipPostalCodeEnabled = true,
+ ZipPostalCodeRequired = true,
+ PhoneEnabled = true,
+ PhoneRequired = false,
+ FaxEnabled = false,
+ FaxRequired = false
+ };
+ return Verify(_mapper.Map<CustomerSettingsModel.AddressSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task AddressSettingsModel_ToDomain()
+ {
+ var model = new CustomerSettingsModel.AddressSettingsModel {
+ NameEnabled = true,
+ CompanyEnabled = true,
+ CountryEnabled = true,
+ StreetAddressEnabled = true
+ };
+ return Verify(_mapper.Map<AddressSettings>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeModel_ToDomain.verified.txt
new file mode 100644
index 000000000..3bf707f8e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeModel_ToDomain.verified.txt
@@ -0,0 +1,18 @@
+{
+ Name: Gift Wrapping,
+ TextPrompt: Add gift wrapping?,
+ IsRequired: false,
+ ShippableProductRequired: false,
+ IsTaxExempt: false,
+ AttributeControlTypeId: TextBox,
+ DisplayOrder: 1,
+ LimitedToGroups: true,
+ CustomerGroups: [
+ grp-001
+ ],
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValueModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValueModel_ToDomain.verified.txt
new file mode 100644
index 000000000..b24a96f69
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValueModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Yes,
+ PriceAdjustment: 3.99,
+ IsPreSelected: false,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValue_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValue_ToModel.verified.txt
new file mode 100644
index 000000000..fcdec9aac
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttributeValue_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Name: Yes,
+ DisplayColorSquaresRgb: false,
+ PriceAdjustment: 3.99,
+ IsPreSelected: false,
+ DisplayOrder: 1,
+ Id: cav-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttribute_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttribute_ToModel.verified.txt
new file mode 100644
index 000000000..2d56afac4
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.CheckoutAttribute_ToModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: Gift Wrapping,
+ TextPrompt: Add gift wrapping?,
+ IsRequired: false,
+ ShippableProductRequired: false,
+ IsTaxExempt: false,
+ TaxCategoryId: tc-001,
+ AttributeControlTypeId: 4,
+ DisplayOrder: 1,
+ ConditionAllowed: false,
+ Id: ca-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..1edc602cd
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ AllowRePostingPayments: true,
+ SkipPaymentIfOnlyOne: false,
+ ShowPaymentIfCartIsZero: false,
+ ShowPaymentDescriptions: true,
+ SkipPaymentInfo: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettings_ToModel.verified.txt
new file mode 100644
index 000000000..7cb8b3728
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.PaymentSettings_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ AllowRePostingPayments: true,
+ SkipPaymentIfOnlyOne: true,
+ ShowPaymentIfCartIsZero: false,
+ ShowPaymentDescriptions: true,
+ SkipPaymentInfo: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethodModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethodModel_ToDomain.verified.txt
new file mode 100644
index 000000000..6da84fae0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethodModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Standard Shipping,
+ Description: 5-7 business days,
+ DisplayOrder: 1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethod_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethod_ToModel.verified.txt
new file mode 100644
index 000000000..5a1a430ad
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingMethod_ToModel.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Standard Shipping,
+ Description: 5-7 business days,
+ DisplayOrder: 1,
+ Id: sm-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..ac77c994c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,11 @@
+{
+ AllowPickUpInStore: true,
+ FreeShippingOverXEnabled: true,
+ FreeShippingOverXValue: 100.0,
+ FreeShippingOverXIncludingTax: false,
+ EstimateShippingEnabled: true,
+ DisplayShipmentEventsToCustomers: false,
+ DisplayShipmentEventsToStoreOwner: false,
+ SkipShippingMethodSelectionIfOnlyOne: false,
+ AdditionalShippingChargeByQty: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettings_ToModel.verified.txt
new file mode 100644
index 000000000..90ac250d9
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.ShippingSettings_ToModel.verified.txt
@@ -0,0 +1,11 @@
+{
+ AllowPickUpInStore: true,
+ FreeShippingOverXEnabled: true,
+ FreeShippingOverXValue: 100.0,
+ FreeShippingOverXIncludingTax: false,
+ EstimateShippingEnabled: true,
+ DisplayShipmentEventsToCustomers: true,
+ DisplayShipmentEventsToStoreOwner: false,
+ SkipShippingMethodSelectionIfOnlyOne: true,
+ AdditionalShippingChargeByQty: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.cs
new file mode 100644
index 000000000..c974ea383
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/ShippingMappingTests.cs
@@ -0,0 +1,170 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Orders;
+using Grand.Domain.Payments;
+using Grand.Domain.Shipping;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Orders;
+using Grand.Web.AdminShared.Models.Payments;
+using Grand.Web.AdminShared.Models.Shipping;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class ShippingMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<ShippingMethodProfile>();
+ cfg.AddProfile<ShippingSettingsProfile>();
+ cfg.AddProfile<PaymentSettingsProfile>();
+ cfg.AddProfile<CheckoutAttributeProfile>();
+ cfg.AddProfile<AddressProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── ShippingMethod ────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ShippingMethod_ToModel()
+ {
+ var source = new ShippingMethod {
+ Id = "sm-001",
+ Name = "Standard Shipping",
+ Description = "5-7 business days",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ShippingMethodModel>(source));
+ }
+
+ [TestMethod]
+ public Task ShippingMethodModel_ToDomain()
+ {
+ var model = new ShippingMethodModel {
+ Name = "Standard Shipping",
+ Description = "5-7 business days",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<ShippingMethod>(model));
+ }
+
+ // ── ShippingSettings ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ShippingSettings_ToModel()
+ {
+ var source = new ShippingSettings {
+ FreeShippingOverXEnabled = true,
+ FreeShippingOverXValue = 100,
+ FreeShippingOverXIncludingTax = false,
+ EstimateShippingEnabled = true,
+ DisplayShipmentEventsToCustomers = true,
+ DisplayShipmentEventsToStoreOwner = false,
+ SkipShippingMethodSelectionIfOnlyOne = true,
+ AllowPickUpInStore = true
+ };
+ return Verify(_mapper.Map<ShippingSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task ShippingSettingsModel_ToDomain()
+ {
+ var model = new ShippingSettingsModel {
+ FreeShippingOverXEnabled = true,
+ FreeShippingOverXValue = 100,
+ EstimateShippingEnabled = true,
+ AllowPickUpInStore = true
+ };
+ return Verify(_mapper.Map<ShippingSettings>(model));
+ }
+
+ // ── PaymentSettings ───────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PaymentSettings_ToModel()
+ {
+ var source = new PaymentSettings {
+ AllowRePostingPayments = true,
+ SkipPaymentIfOnlyOne = true,
+ ShowPaymentDescriptions = true,
+ SkipPaymentInfo = false
+ };
+ return Verify(_mapper.Map<PaymentSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task PaymentSettingsModel_ToDomain()
+ {
+ var model = new PaymentSettingsModel {
+ AllowRePostingPayments = true,
+ ShowPaymentDescriptions = true
+ };
+ return Verify(_mapper.Map<PaymentSettings>(model));
+ }
+
+ // ── CheckoutAttribute ─────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CheckoutAttribute_ToModel()
+ {
+ var source = new CheckoutAttribute {
+ Id = "ca-001",
+ Name = "Gift Wrapping",
+ TextPrompt = "Add gift wrapping?",
+ IsRequired = false,
+ AttributeControlTypeId = (AttributeControlType)4,
+ DisplayOrder = 1,
+ TaxCategoryId = "tc-001",
+ ShippableProductRequired = false
+ };
+ return Verify(_mapper.Map<CheckoutAttributeModel>(source));
+ }
+
+ [TestMethod]
+ public Task CheckoutAttributeModel_ToDomain()
+ {
+ var model = new CheckoutAttributeModel {
+ Name = "Gift Wrapping",
+ TextPrompt = "Add gift wrapping?",
+ IsRequired = false,
+ AttributeControlTypeId = 4,
+ DisplayOrder = 1,
+ CustomerGroups = ["grp-001"],
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<CheckoutAttribute>(model));
+ }
+
+ [TestMethod]
+ public Task CheckoutAttributeValue_ToModel()
+ {
+ var source = new CheckoutAttributeValue {
+ Id = "cav-001",
+ Name = "Yes",
+ PriceAdjustment = 3.99,
+ WeightAdjustment = 0,
+ IsPreSelected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CheckoutAttributeValueModel>(source));
+ }
+
+ [TestMethod]
+ public Task CheckoutAttributeValueModel_ToDomain()
+ {
+ var model = new CheckoutAttributeValueModel {
+ Name = "Yes",
+ PriceAdjustment = 3.99,
+ IsPreSelected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CheckoutAttributeValue>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.AdminSiteMap_ToMenuModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.AdminSiteMap_ToMenuModel.verified.txt
new file mode 100644
index 000000000..46d39b443
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.AdminSiteMap_ToMenuModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ SystemName: Dashboard,
+ ResourceName: Admin.Dashboard,
+ ControllerName: Admin,
+ ActionName: Dashboard,
+ Url: /Admin/Dashboard,
+ IconClass: fa fa-home,
+ DisplayOrder: 1,
+ OpenUrlInNewTab: false,
+ AllPermissions: false,
+ Id: menu-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.CampaignModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.CampaignModel_ToDomain.verified.txt
new file mode 100644
index 000000000..efb241267
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.CampaignModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Summer Campaign,
+ Subject: Summer Sale!,
+ Body: Check our summer deals,
+ StoreId: store-001,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Campaign_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Campaign_ToModel.verified.txt
new file mode 100644
index 000000000..6d49fbe67
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Campaign_ToModel.verified.txt
@@ -0,0 +1,7 @@
+{
+ Name: Summer Campaign,
+ Subject: Summer Sale!,
+ Body: Check our summer deals,
+ StoreId: store-001,
+ Id: camp-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccountModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccountModel_ToDomain.verified.txt
new file mode 100644
index 000000000..58c8de5c0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccountModel_ToDomain.verified.txt
@@ -0,0 +1,9 @@
+{
+ DisplayName: Grand Store,
+ Host: smtp.example.com,
+ Port: 587,
+ Username: [email protected],
+ UseServerCertificateValidation: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccount_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccount_ToModel.verified.txt
new file mode 100644
index 000000000..afd726320
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.EmailAccount_ToModel.verified.txt
@@ -0,0 +1,10 @@
+{
+ DisplayName: Grand Store,
+ Host: smtp.example.com,
+ Port: 587,
+ Username: [email protected],
+ UseServerCertificateValidation: false,
+ IsDefaultEmailAccount: false,
+ Id: ea-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MenuModel_ToAdminSiteMap.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MenuModel_ToAdminSiteMap.verified.txt
new file mode 100644
index 000000000..63b6f527b
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MenuModel_ToAdminSiteMap.verified.txt
@@ -0,0 +1,11 @@
+{
+ SystemName: Dashboard,
+ ResourceName: Admin.Dashboard,
+ ControllerName: Admin,
+ ActionName: Dashboard,
+ IconClass: fa fa-home,
+ DisplayOrder: 1,
+ OpenUrlInNewTab: false,
+ AllPermissions: false,
+ Id: menu-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplateModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplateModel_ToDomain.verified.txt
new file mode 100644
index 000000000..9693bb272
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplateModel_ToDomain.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: OrderPlaced.CustomerNotification,
+ Subject: Your order has been placed,
+ Body: Order body,
+ IsActive: true,
+ EmailAccountId: ea-001,
+ LimitedToStores: true,
+ Stores: [
+ store-001
+ ],
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplate_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplate_ToModel.verified.txt
new file mode 100644
index 000000000..6d883adf6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.MessageTemplate_ToModel.verified.txt
@@ -0,0 +1,15 @@
+{
+ Name: OrderPlaced.CustomerNotification,
+ BccEmailAddresses: ,
+ Subject: Your order has been placed,
+ Body: Order body,
+ IsActive: true,
+ SendImmediately: false,
+ DelayBeforeSend: 0,
+ HasAttachedDownload: false,
+ EmailAccountId: ea-001,
+ Stores: [
+ store-001
+ ],
+ Id: mt-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmailModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmailModel_ToDomain.verified.txt
new file mode 100644
index 000000000..4645757c0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmailModel_ToDomain.verified.txt
@@ -0,0 +1,7 @@
+{
+ Subject: Order Confirmation,
+ Body: <p>Thank you!</p>,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmail_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmail_ToModel.verified.txt
new file mode 100644
index 000000000..443c72509
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.QueuedEmail_ToModel.verified.txt
@@ -0,0 +1,13 @@
+{
+ Id: qe-001,
+ FromName: Store,
+ ToName: Customer,
+ ReplyTo: ,
+ CC: ,
+ Bcc: ,
+ Subject: Order Confirmation,
+ Body: <p>Thank you!</p>,
+ SendImmediately: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTaskModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTaskModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8fcce0481
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTaskModel_ToDomain.verified.txt
@@ -0,0 +1,6 @@
+{
+ Enabled: true,
+ StopOnError: false,
+ TimeInterval: 60,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTask_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTask_ToModel.verified.txt
new file mode 100644
index 000000000..7aa6c133d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.ScheduleTask_ToModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ ScheduleTaskName: Grand.Services.Catalog.UpdateExchangeRateTask, Grand.Services,
+ Enabled: true,
+ StopOnError: false,
+ TimeInterval: 60,
+ StoreId: ,
+ Id: st-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorModel_ToDomain.verified.txt
new file mode 100644
index 000000000..f95607219
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorModel_ToDomain.verified.txt
@@ -0,0 +1,14 @@
+{
+ Name: Best Vendor,
+ Description: Top vendor,
+ Active: false,
+ Deleted: false,
+ PageSize: 5,
+ AllowCustomersToSelectPageSize: false,
+ AllowCustomerReviews: false,
+ Address: {
+ Id: ObjectId_1
+ },
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain.verified.txt
new file mode 100644
index 000000000..8e878d4c6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain.verified.txt
@@ -0,0 +1,57 @@
+{
+ VendorsBlockItemsToDisplay: 3,
+ ShowVendorOnProductDetailsPage: true,
+ AllowCustomersToContactVendors: true,
+ AllowCustomersToApplyForVendorAccount: false,
+ AllowSearchByVendor: false,
+ TermsOfServiceEnabled: false,
+ AllowVendorsToEditInfo: false,
+ NotifyStoreOwnerAboutVendorInformationChange: false,
+ VendorReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewVendor: false,
+ VendorReviewPossibleOnlyAfterPurchasing: false,
+ NotifyVendorAboutNewVendorReviews: false,
+ DefaultAllowCustomerReview: false,
+ VendorReviewPossibleOnlyOnce: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ NoteEnabled: false,
+ FaxRequired: false,
+ AddressSettings: {
+ NameEnabled: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ DisallowUsersToChangeEmail: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain_WithAddressSettings.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain_WithAddressSettings.verified.txt
new file mode 100644
index 000000000..6e61b3d09
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettingsModel_ToDomain_WithAddressSettings.verified.txt
@@ -0,0 +1,57 @@
+{
+ VendorsBlockItemsToDisplay: 5,
+ ShowVendorOnProductDetailsPage: false,
+ AllowCustomersToContactVendors: false,
+ AllowCustomersToApplyForVendorAccount: false,
+ AllowSearchByVendor: false,
+ TermsOfServiceEnabled: false,
+ AllowVendorsToEditInfo: false,
+ NotifyStoreOwnerAboutVendorInformationChange: false,
+ VendorReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewVendor: false,
+ VendorReviewPossibleOnlyAfterPurchasing: false,
+ NotifyVendorAboutNewVendorReviews: false,
+ DefaultAllowCustomerReview: false,
+ VendorReviewPossibleOnlyOnce: false,
+ CompanyEnabled: true,
+ CompanyRequired: true,
+ StreetAddressEnabled: true,
+ StreetAddressRequired: true,
+ StreetAddress2Enabled: true,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: true,
+ ZipPostalCodeRequired: false,
+ CityEnabled: true,
+ CityRequired: false,
+ CountryEnabled: true,
+ StateProvinceEnabled: true,
+ PhoneEnabled: true,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ NoteEnabled: false,
+ FaxRequired: false,
+ AddressSettings: {
+ NameEnabled: false,
+ CompanyEnabled: true,
+ CompanyRequired: true,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ StreetAddressEnabled: true,
+ StreetAddressRequired: true,
+ StreetAddress2Enabled: true,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: true,
+ ZipPostalCodeRequired: false,
+ CityEnabled: true,
+ CityRequired: false,
+ CountryEnabled: true,
+ StateProvinceEnabled: true,
+ PhoneEnabled: true,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ DisallowUsersToChangeEmail: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel.verified.txt
new file mode 100644
index 000000000..87034aff1
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel.verified.txt
@@ -0,0 +1,35 @@
+{
+ VendorsBlockItemsToDisplay: 3,
+ ShowVendorOnProductDetailsPage: true,
+ AllowCustomersToContactVendors: true,
+ AllowCustomersToApplyForVendorAccount: false,
+ AllowSearchByVendor: true,
+ AllowVendorsToEditInfo: false,
+ NotifyStoreOwnerAboutVendorInformationChange: true,
+ TermsOfServiceEnabled: false,
+ VendorReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewVendor: false,
+ VendorReviewPossibleOnlyAfterPurchasing: false,
+ NotifyVendorAboutNewVendorReviews: false,
+ DefaultAllowCustomerReview: false,
+ NumberOfReview: 10,
+ VendorReviewPossibleOnlyOnce: false,
+ AddressSettings: {
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ CityEnabled: false,
+ CityRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel_WithAddressSettings.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel_WithAddressSettings.verified.txt
new file mode 100644
index 000000000..ab0cac556
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.VendorSettings_ToModel_WithAddressSettings.verified.txt
@@ -0,0 +1,35 @@
+{
+ VendorsBlockItemsToDisplay: 5,
+ ShowVendorOnProductDetailsPage: false,
+ AllowCustomersToContactVendors: false,
+ AllowCustomersToApplyForVendorAccount: false,
+ AllowSearchByVendor: false,
+ AllowVendorsToEditInfo: false,
+ NotifyStoreOwnerAboutVendorInformationChange: false,
+ TermsOfServiceEnabled: false,
+ VendorReviewsMustBeApproved: false,
+ AllowAnonymousUsersToReviewVendor: false,
+ VendorReviewPossibleOnlyAfterPurchasing: false,
+ NotifyVendorAboutNewVendorReviews: false,
+ DefaultAllowCustomerReview: false,
+ NumberOfReview: 10,
+ VendorReviewPossibleOnlyOnce: false,
+ AddressSettings: {
+ CompanyEnabled: true,
+ CompanyRequired: true,
+ StreetAddressEnabled: true,
+ StreetAddressRequired: true,
+ StreetAddress2Enabled: true,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: true,
+ ZipPostalCodeRequired: false,
+ CityEnabled: true,
+ CityRequired: false,
+ CountryEnabled: true,
+ StateProvinceEnabled: true,
+ PhoneEnabled: true,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Vendor_ToModel.verified.txt b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Vendor_ToModel.verified.txt
new file mode 100644
index 000000000..b0644d798
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.Vendor_ToModel.verified.txt
@@ -0,0 +1,45 @@
+{
+ Name: Best Vendor,
+ Description: Top vendor,
+ PictureId: pic-vendor,
+ AdminComment: Internal note,
+ Active: true,
+ DisplayOrder: 1,
+ AllowCustomerReviews: true,
+ SeName: best-vendor,
+ PageSize: 10,
+ AllowCustomersToSelectPageSize: false,
+ PageSizeOptions: 10, 20,
+ Address: {
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ Id: ObjectId_1
+ },
+ Id: vendor-001
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.cs b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.cs
new file mode 100644
index 000000000..40f7b5704
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/AdminShared/SystemMappingTests.cs
@@ -0,0 +1,339 @@
+using Grand.Mapping;
+using Grand.Domain.Admin;
+using Grand.Domain.Customers;
+using Grand.Domain.Messages;
+using Grand.Domain.Tasks;
+using Grand.Web.AdminShared.Mapper;
+using Grand.Web.AdminShared.Models.Customers;
+using Grand.Web.AdminShared.Models.Menu;
+using Grand.Web.AdminShared.Models.Messages;
+using Grand.Web.AdminShared.Models.Settings;
+using Grand.Web.AdminShared.Models.Tasks;
+using Grand.Web.AdminShared.Models.Vendors;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using DomainVendor = Grand.Domain.Vendors.Vendor;
+using VendorSettings = Grand.Domain.Vendors.VendorSettings;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.AdminShared;
+
+[TestClass]
+public class SystemMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<EmailAccountProfile>();
+ cfg.AddProfile<QueuedEmailProfile>();
+ cfg.AddProfile<MessageTemplateProfile>();
+ cfg.AddProfile<CampaignProfile>();
+ cfg.AddProfile<MenuProfile>();
+ cfg.AddProfile<ScheduleTaskProfile>();
+ cfg.AddProfile<VendorProfile>();
+ cfg.AddProfile<VendorSettingsProfile>();
+ cfg.AddProfile<AddressProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── EmailAccount ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task EmailAccount_ToModel()
+ {
+ var source = new EmailAccount {
+ Id = "ea-001",
+ Email = "[email protected]",
+ DisplayName = "Grand Store",
+ Host = "smtp.example.com",
+ Port = 587,
+ Username = "[email protected]"
+ };
+ return Verify(_mapper.Map<EmailAccountModel>(source));
+ }
+
+ [TestMethod]
+ public Task EmailAccountModel_ToDomain()
+ {
+ var model = new EmailAccountModel {
+ Email = "[email protected]",
+ DisplayName = "Grand Store",
+ Host = "smtp.example.com",
+ Port = 587,
+ Username = "[email protected]"
+ };
+ return Verify(_mapper.Map<EmailAccount>(model));
+ }
+
+ // ── QueuedEmail ───────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task QueuedEmail_ToModel()
+ {
+ var source = new QueuedEmail {
+ Id = "qe-001",
+ PriorityId = QueuedEmailPriority.High,
+ From = "[email protected]",
+ FromName = "Store",
+ ToName = "Customer",
+ ReplyTo = "",
+ CC = "",
+ Bcc = "",
+ Subject = "Order Confirmation",
+ Body = "<p>Thank you!</p>",
+ SentTries = 0
+ };
+ return Verify(_mapper.Map<QueuedEmailModel>(source));
+ }
+
+ [TestMethod]
+ public Task QueuedEmailModel_ToDomain()
+ {
+ var model = new QueuedEmailModel {
+ From = "[email protected]",
+ Subject = "Order Confirmation",
+ Body = "<p>Thank you!</p>"
+ };
+ return Verify(_mapper.Map<QueuedEmail>(model));
+ }
+
+ // ── MessageTemplate ───────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task MessageTemplate_ToModel()
+ {
+ var source = new MessageTemplate {
+ Id = "mt-001",
+ Name = "OrderPlaced.CustomerNotification",
+ BccEmailAddresses = "",
+ Subject = "Your order has been placed",
+ Body = "Order body",
+ IsActive = true,
+ EmailAccountId = "ea-001",
+ DelayBeforeSend = 0,
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<MessageTemplateModel>(source));
+ }
+
+ [TestMethod]
+ public Task MessageTemplateModel_ToDomain()
+ {
+ var model = new MessageTemplateModel {
+ Name = "OrderPlaced.CustomerNotification",
+ Subject = "Your order has been placed",
+ Body = "Order body",
+ IsActive = true,
+ EmailAccountId = "ea-001",
+ Stores = ["store-001"]
+ };
+ return Verify(_mapper.Map<MessageTemplate>(model));
+ }
+
+ // ── Campaign ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Campaign_ToModel()
+ {
+ var source = new Campaign {
+ Id = "camp-001",
+ Name = "Summer Campaign",
+ Subject = "Summer Sale!",
+ Body = "Check our summer deals",
+ StoreId = "store-001"
+ };
+ return Verify(_mapper.Map<CampaignModel>(source));
+ }
+
+ [TestMethod]
+ public Task CampaignModel_ToDomain()
+ {
+ var model = new CampaignModel {
+ Name = "Summer Campaign",
+ Subject = "Summer Sale!",
+ Body = "Check our summer deals",
+ StoreId = "store-001"
+ };
+ return Verify(_mapper.Map<Campaign>(model));
+ }
+
+ // ── AdminSiteMap (Menu) ───────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AdminSiteMap_ToMenuModel()
+ {
+ var source = new AdminSiteMap {
+ Id = "menu-001",
+ SystemName = "Dashboard",
+ ResourceName = "Admin.Dashboard",
+ ControllerName = "Admin",
+ ActionName = "Dashboard",
+ IconClass = "fa fa-home",
+ DisplayOrder = 1,
+ Url = "/Admin/Dashboard"
+ };
+ return Verify(_mapper.Map<MenuModel>(source));
+ }
+
+ [TestMethod]
+ public Task MenuModel_ToAdminSiteMap()
+ {
+ var model = new MenuModel {
+ Id = "menu-001",
+ SystemName = "Dashboard",
+ ResourceName = "Admin.Dashboard",
+ ControllerName = "Admin",
+ ActionName = "Dashboard",
+ IconClass = "fa fa-home",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<AdminSiteMap>(model));
+ }
+
+ // ── ScheduleTask ──────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ScheduleTask_ToModel()
+ {
+ var source = new ScheduleTask {
+ Id = "st-001",
+ ScheduleTaskName = "Grand.Services.Catalog.UpdateExchangeRateTask, Grand.Services",
+ Enabled = true,
+ StopOnError = false,
+ TimeInterval = 60,
+ StoreId = ""
+ };
+ return Verify(_mapper.Map<ScheduleTaskModel>(source));
+ }
+
+ [TestMethod]
+ public Task ScheduleTaskModel_ToDomain()
+ {
+ var model = new ScheduleTaskModel {
+ TimeInterval = 60,
+ Enabled = true,
+ StopOnError = false
+ };
+ return Verify(_mapper.Map<ScheduleTask>(model));
+ }
+
+ // ── Vendor ────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Vendor_ToModel()
+ {
+ var source = new DomainVendor {
+ Id = "vendor-001",
+ Name = "Best Vendor",
+ Email = "[email protected]",
+ Description = "Top vendor",
+ AdminComment = "Internal note",
+ PictureId = "pic-vendor",
+ PageSize = 10,
+ AllowCustomersToSelectPageSize = false,
+ PageSizeOptions = "10, 20",
+ Active = true,
+ DisplayOrder = 1,
+ SeName = "best-vendor",
+ AllowCustomerReviews = true
+ };
+ return Verify(_mapper.Map<VendorModel>(source));
+ }
+
+ [TestMethod]
+ public Task VendorModel_ToDomain()
+ {
+ var model = new VendorModel {
+ Name = "Best Vendor",
+ Email = "[email protected]",
+ Description = "Top vendor",
+ Active = true
+ };
+ return Verify(_mapper.Map<DomainVendor>(model));
+ }
+
+ // ── VendorSettings ────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task VendorSettings_ToModel()
+ {
+ var source = new VendorSettings {
+ VendorsBlockItemsToDisplay = 3,
+ ShowVendorOnProductDetailsPage = true,
+ AllowCustomersToContactVendors = true,
+ AllowCustomersToApplyForVendorAccount = false,
+ AllowSearchByVendor = true,
+ AllowVendorsToEditInfo = false,
+ NotifyStoreOwnerAboutVendorInformationChange = true
+ };
+ return Verify(_mapper.Map<VendorSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task VendorSettingsModel_ToDomain()
+ {
+ var model = new VendorSettingsModel {
+ VendorsBlockItemsToDisplay = 3,
+ ShowVendorOnProductDetailsPage = true,
+ AllowCustomersToContactVendors = true
+ };
+ return Verify(_mapper.Map<VendorSettings>(model));
+ }
+
+ [TestMethod]
+ public Task VendorSettings_ToModel_WithAddressSettings()
+ {
+ var source = new VendorSettings {
+ VendorsBlockItemsToDisplay = 5,
+ CityEnabled = true,
+ CityRequired = false,
+ CompanyEnabled = true,
+ CompanyRequired = true,
+ CountryEnabled = true,
+ FaxEnabled = false,
+ FaxRequired = false,
+ PhoneEnabled = true,
+ PhoneRequired = false,
+ StateProvinceEnabled = true,
+ StreetAddress2Enabled = true,
+ StreetAddress2Required = false,
+ StreetAddressEnabled = true,
+ StreetAddressRequired = true,
+ ZipPostalCodeEnabled = true,
+ ZipPostalCodeRequired = false
+ };
+ return Verify(_mapper.Map<VendorSettingsModel>(source));
+ }
+
+ [TestMethod]
+ public Task VendorSettingsModel_ToDomain_WithAddressSettings()
+ {
+ var model = new VendorSettingsModel {
+ VendorsBlockItemsToDisplay = 5,
+ AddressSettings = new VendorSettingsModel.AddressSettingsModel {
+ CityEnabled = true,
+ CityRequired = false,
+ CompanyEnabled = true,
+ CompanyRequired = true,
+ CountryEnabled = true,
+ FaxEnabled = false,
+ FaxRequired = false,
+ PhoneEnabled = true,
+ PhoneRequired = false,
+ StateProvinceEnabled = true,
+ StreetAddress2Enabled = true,
+ StreetAddress2Required = false,
+ StreetAddressEnabled = true,
+ StreetAddressRequired = true,
+ ZipPostalCodeEnabled = true,
+ ZipPostalCodeRequired = false
+ }
+ };
+ return Verify(_mapper.Map<VendorSettings>(model));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.AddressDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.AddressDto_ToEntity.verified.txt
new file mode 100644
index 000000000..3f00632e0
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.AddressDto_ToEntity.verified.txt
@@ -0,0 +1,11 @@
+{
+ FirstName: John,
+ LastName: Doe,
+ CountryId: US,
+ City: Springfield,
+ Address1: 123 Main St,
+ ZipPostalCode: 12345,
+ PhoneNumber: 123-456-7890,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Address_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Address_ToDto.verified.txt
new file mode 100644
index 000000000..7e7ef8beb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Address_ToDto.verified.txt
@@ -0,0 +1,11 @@
+{
+ Id: addr-1,
+ FirstName: John,
+ LastName: Doe,
+ CountryId: US,
+ City: Springfield,
+ Address1: 123 Main St,
+ ZipPostalCode: 12345,
+ PhoneNumber: 123-456-7890
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.BrandDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.BrandDto_ToEntity.verified.txt
new file mode 100644
index 000000000..3175dfef7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.BrandDto_ToEntity.verified.txt
@@ -0,0 +1,17 @@
+{
+ Name: Nike,
+ Description: Sports brand,
+ MetaTitle: Nike,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ ShowOnHomePage: true,
+ IncludeInMenu: false,
+ DefaultSort: -1,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToGroups: false,
+ SeName: nike,
+ LimitedToStores: false,
+ Id: brand-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Brand_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Brand_ToDto.verified.txt
new file mode 100644
index 000000000..0a043d19e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Brand_ToDto.verified.txt
@@ -0,0 +1,14 @@
+{
+ Name: Nike,
+ SeName: nike,
+ Description: Sports brand,
+ MetaTitle: Nike,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ ShowOnHomePage: true,
+ IncludeInMenu: false,
+ Published: true,
+ DisplayOrder: 1,
+ Id: brand-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CategoryDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CategoryDto_ToEntity.verified.txt
new file mode 100644
index 000000000..84464dce2
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CategoryDto_ToEntity.verified.txt
@@ -0,0 +1,18 @@
+{
+ Name: Electronics,
+ Description: Electronic items,
+ MetaTitle: Electronics,
+ PageSize: 9,
+ AllowCustomersToSelectPageSize: true,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ ShowOnSearchBox: false,
+ IncludeInMenu: false,
+ Published: true,
+ DefaultSort: -1,
+ HideOnCatalog: false,
+ LimitedToGroups: false,
+ SeName: electronics,
+ LimitedToStores: false,
+ Id: cat-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Category_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Category_ToDto.verified.txt
new file mode 100644
index 000000000..c45f280ee
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Category_ToDto.verified.txt
@@ -0,0 +1,15 @@
+{
+ Name: Electronics,
+ Description: Electronic items,
+ MetaTitle: Electronics,
+ SeName: electronics,
+ PageSize: 9,
+ AllowCustomersToSelectPageSize: true,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ Published: true,
+ HideOnCatalog: false,
+ ShowOnSearchBox: false,
+ Id: cat-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CollectionDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CollectionDto_ToEntity.verified.txt
new file mode 100644
index 000000000..d25743938
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CollectionDto_ToEntity.verified.txt
@@ -0,0 +1,16 @@
+{
+ Name: Summer 2025,
+ Description: Summer collection,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ DefaultSort: -1,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToGroups: false,
+ SeName: summer-2025,
+ LimitedToStores: false,
+ Id: col-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Collection_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Collection_ToDto.verified.txt
new file mode 100644
index 000000000..40b7267f6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Collection_ToDto.verified.txt
@@ -0,0 +1,13 @@
+{
+ Name: Summer 2025,
+ SeName: summer-2025,
+ Description: Summer collection,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ Published: true,
+ DisplayOrder: 1,
+ Id: col-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerDto_ToEntity.verified.txt
new file mode 100644
index 000000000..67ca818b7
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerDto_ToEntity.verified.txt
@@ -0,0 +1,12 @@
+{
+ CustomerGuid: Guid_1,
+ Username: customer1,
+ IsTaxExempt: false,
+ FreeShipping: false,
+ Active: true,
+ Deleted: false,
+ IsSystemAccount: false,
+ HasContributions: false,
+ Id: cust-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroupDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroupDto_ToEntity.verified.txt
new file mode 100644
index 000000000..a8b0eb996
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroupDto_ToEntity.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: VIP Customers,
+ FreeShipping: true,
+ TaxExempt: false,
+ Active: false,
+ IsSystem: false,
+ SystemName: Vip,
+ EnablePasswordLifetime: false,
+ Id: cg-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroup_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroup_ToDto.verified.txt
new file mode 100644
index 000000000..a8b0eb996
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.CustomerGroup_ToDto.verified.txt
@@ -0,0 +1,10 @@
+{
+ Name: VIP Customers,
+ FreeShipping: true,
+ TaxExempt: false,
+ Active: false,
+ IsSystem: false,
+ SystemName: Vip,
+ EnablePasswordLifetime: false,
+ Id: cg-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_EmptyUserFields.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_EmptyUserFields.verified.txt
new file mode 100644
index 000000000..3e3ca300f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_EmptyUserFields.verified.txt
@@ -0,0 +1,10 @@
+{
+ CustomerGuid: Guid_1,
+ Username: customer1,
+ IsTaxExempt: false,
+ FreeShipping: false,
+ Active: true,
+ Deleted: false,
+ Id: cust-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_WithUserFields.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_WithUserFields.verified.txt
new file mode 100644
index 000000000..bd469883a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Customer_ToDto_WithUserFields.verified.txt
@@ -0,0 +1,24 @@
+{
+ CustomerGuid: Guid_1,
+ Username: customer1,
+ IsTaxExempt: false,
+ FreeShipping: false,
+ Active: true,
+ Deleted: false,
+ Gender: M,
+ FirstName: John,
+ LastName: Doe,
+ Company: Acme Corp,
+ StreetAddress: 123 Main St,
+ StreetAddress2: Apt 4,
+ ZipPostalCode: 10001,
+ City: New York,
+ CountryId: country-001,
+ StateProvinceId: state-001,
+ Phone: +1-555-0123,
+ Fax: +1-555-0124,
+ VatNumber: VAT123456,
+ VatNumberStatusId: 20,
+ Id: cust-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PictureDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PictureDto_ToEntity.verified.txt
new file mode 100644
index 000000000..3f73ef77c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PictureDto_ToEntity.verified.txt
@@ -0,0 +1,8 @@
+{
+ MimeType: image/jpeg,
+ SeoFilename: product-image,
+ AltAttribute: Product image,
+ TitleAttribute: Product,
+ IsNew: false,
+ Id: pic-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Picture_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Picture_ToDto.verified.txt
new file mode 100644
index 000000000..3f73ef77c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Picture_ToDto.verified.txt
@@ -0,0 +1,8 @@
+{
+ MimeType: image/jpeg,
+ SeoFilename: product-image,
+ AltAttribute: Product image,
+ TitleAttribute: Product,
+ IsNew: false,
+ Id: pic-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PredefinedProductAttributeValue_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PredefinedProductAttributeValue_ToDto.verified.txt
new file mode 100644
index 000000000..f4ef4f472
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.PredefinedProductAttributeValue_ToDto.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Red,
+ IsPreSelected: false,
+ DisplayOrder: 1,
+ Id: ppav-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeDto_ToEntity.verified.txt
new file mode 100644
index 000000000..1636ef37a
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeDto_ToEntity.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Color,
+ Description: Product color,
+ LimitedToStores: false,
+ Id: pa-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMappingDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMappingDto_ToEntity.verified.txt
new file mode 100644
index 000000000..16b553e66
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMappingDto_ToEntity.verified.txt
@@ -0,0 +1,9 @@
+{
+ ProductAttributeId: pa-1,
+ TextPrompt: Choose color,
+ IsRequired: true,
+ ShowOnCatalogPage: false,
+ Combination: false,
+ AttributeControlTypeId: DropdownList,
+ Id: pam-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMapping_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMapping_ToDto.verified.txt
new file mode 100644
index 000000000..731a2d508
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttributeMapping_ToDto.verified.txt
@@ -0,0 +1,7 @@
+{
+ ProductAttributeId: pa-1,
+ TextPrompt: Choose color,
+ IsRequired: true,
+ AttributeControlTypeId: DropdownList,
+ Id: pam-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttribute_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttribute_ToDto.verified.txt
new file mode 100644
index 000000000..d4d20f225
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductAttribute_ToDto.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Color,
+ Description: Product color,
+ Id: pa-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductDto_ToEntity.verified.txt
new file mode 100644
index 000000000..362d74650
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductDto_ToEntity.verified.txt
@@ -0,0 +1,44 @@
+{
+ VisibleIndividually: false,
+ Name: Test Product,
+ ShortDescription: Short,
+ FullDescription: Full description,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: SKU001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 100,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 29.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: true,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ Id: prod-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductTierPriceDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductTierPriceDto_ToEntity.verified.txt
new file mode 100644
index 000000000..11ec65bc6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.ProductTierPriceDto_ToEntity.verified.txt
@@ -0,0 +1,7 @@
+{
+ StoreId: ,
+ CustomerGroupId: ,
+ Quantity: 10,
+ Price: 9.99,
+ Id: tp-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Product_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Product_ToDto.verified.txt
new file mode 100644
index 000000000..4d431c979
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.Product_ToDto.verified.txt
@@ -0,0 +1,41 @@
+{
+ VisibleIndividually: false,
+ Name: Test Product,
+ ShortDescription: Short,
+ FullDescription: Full description,
+ ShowOnHomePage: false,
+ AllowCustomerReviews: false,
+ Sku: SKU001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 100,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 29.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: true,
+ Id: prod-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeDto_ToEntity.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeDto_ToEntity.verified.txt
new file mode 100644
index 000000000..244f2ef9e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeDto_ToEntity.verified.txt
@@ -0,0 +1,6 @@
+{
+ Name: Material,
+ DisplayOrder: 1,
+ LimitedToStores: false,
+ Id: sa-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeOption_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeOption_ToDto.verified.txt
new file mode 100644
index 000000000..ecd59d72c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttributeOption_ToDto.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Cotton,
+ ColorSquaresRgb: #FFFFFF,
+ Id: sao-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttribute_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttribute_ToDto.verified.txt
new file mode 100644
index 000000000..e83755ebf
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.SpecificationAttribute_ToDto.verified.txt
@@ -0,0 +1,5 @@
+{
+ Name: Material,
+ DisplayOrder: 1,
+ Id: sa-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.TierPrice_ToDto.verified.txt b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.TierPrice_ToDto.verified.txt
new file mode 100644
index 000000000..11ec65bc6
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.TierPrice_ToDto.verified.txt
@@ -0,0 +1,7 @@
+{
+ StoreId: ,
+ CustomerGroupId: ,
+ Quantity: 10,
+ Price: 9.99,
+ Id: tp-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.cs b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.cs
new file mode 100644
index 000000000..4ad226175
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Api/ApiMappingTests.cs
@@ -0,0 +1,466 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Common;
+using Grand.Domain.Customers;
+using Grand.Domain.Media;
+using Grand.Module.Api.DTOs.Catalog;
+using Grand.Module.Api.DTOs.Common;
+using Grand.Module.Api.DTOs.Customers;
+using Grand.Module.Api.Infrastructure.Mapper.Profiles;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+using AddressProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.AddressProfile;
+using BrandProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.BrandProfile;
+using CategoryProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.CategoryProfile;
+using CollectionProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.CollectionProfile;
+using SpecificationAttributeProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.SpecificationAttributeProfile;
+using TierPriceProfile = Grand.Module.Api.Infrastructure.Mapper.Profiles.TierPriceProfile;
+
+namespace Grand.Mapping.Tests.Api;
+
+[TestClass]
+public class ApiMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<AddressProfile>();
+ cfg.AddProfile<BrandProfile>();
+ cfg.AddProfile<CategoryProfile>();
+ cfg.AddProfile<CollectionProfile>();
+ cfg.AddProfile<CustomerGroupProfile>();
+ cfg.AddProfile<CustomerProfile>();
+ cfg.AddProfile<PictureProfile>();
+ cfg.AddProfile<ProductAttributeMappingProfile>();
+ cfg.AddProfile<ProductAttributeProfile>();
+ cfg.AddProfile<ProductProfile>();
+ cfg.AddProfile<SpecificationAttributeProfile>();
+ cfg.AddProfile<TierPriceProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Address ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task AddressDto_ToEntity()
+ {
+ var dto = new AddressDto {
+ FirstName = "John",
+ LastName = "Doe",
+ Email = "[email protected]",
+ PhoneNumber = "123-456-7890",
+ Address1 = "123 Main St",
+ City = "Springfield",
+ ZipPostalCode = "12345",
+ CountryId = "US"
+ };
+ return Verify(_mapper.Map<Address>(dto));
+ }
+
+ [TestMethod]
+ public Task Address_ToDto()
+ {
+ var entity = new Address {
+ Id = "addr-1",
+ FirstName = "John",
+ LastName = "Doe",
+ Email = "[email protected]",
+ PhoneNumber = "123-456-7890",
+ Address1 = "123 Main St",
+ City = "Springfield",
+ ZipPostalCode = "12345",
+ CountryId = "US"
+ };
+ return Verify(_mapper.Map<AddressDto>(entity));
+ }
+
+ // ── Brand ─────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BrandDto_ToEntity()
+ {
+ var dto = new BrandDto {
+ Id = "brand-1",
+ Name = "Nike",
+ SeName = "nike",
+ Description = "Sports brand",
+ MetaTitle = "Nike",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ ShowOnHomePage = true,
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<Brand>(dto));
+ }
+
+ [TestMethod]
+ public Task Brand_ToDto()
+ {
+ var entity = new Brand {
+ Id = "brand-1",
+ Name = "Nike",
+ SeName = "nike",
+ Description = "Sports brand",
+ MetaTitle = "Nike",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ ShowOnHomePage = true,
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<BrandDto>(entity));
+ }
+
+ // ── Category ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CategoryDto_ToEntity()
+ {
+ var dto = new CategoryDto {
+ Id = "cat-1",
+ Name = "Electronics",
+ SeName = "electronics",
+ Description = "Electronic items",
+ MetaTitle = "Electronics",
+ PageSize = 9,
+ AllowCustomersToSelectPageSize = true,
+ Published = true,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<Category>(dto));
+ }
+
+ [TestMethod]
+ public Task Category_ToDto()
+ {
+ var entity = new Category {
+ Id = "cat-1",
+ Name = "Electronics",
+ SeName = "electronics",
+ Description = "Electronic items",
+ MetaTitle = "Electronics",
+ PageSize = 9,
+ AllowCustomersToSelectPageSize = true,
+ Published = true,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<CategoryDto>(entity));
+ }
+
+ // ── Collection ────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CollectionDto_ToEntity()
+ {
+ var dto = new CollectionDto {
+ Id = "col-1",
+ Name = "Summer 2025",
+ SeName = "summer-2025",
+ Description = "Summer collection",
+ PageSize = 12,
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<Collection>(dto));
+ }
+
+ [TestMethod]
+ public Task Collection_ToDto()
+ {
+ var entity = new Collection {
+ Id = "col-1",
+ Name = "Summer 2025",
+ SeName = "summer-2025",
+ Description = "Summer collection",
+ PageSize = 12,
+ Published = true,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<CollectionDto>(entity));
+ }
+
+ // ── CustomerGroup ─────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerGroupDto_ToEntity()
+ {
+ var dto = new CustomerGroupDto {
+ Id = "cg-1",
+ Name = "VIP Customers",
+ SystemName = "Vip",
+ FreeShipping = true
+ };
+ return Verify(_mapper.Map<CustomerGroup>(dto));
+ }
+
+ [TestMethod]
+ public Task CustomerGroup_ToDto()
+ {
+ var entity = new CustomerGroup {
+ Id = "cg-1",
+ Name = "VIP Customers",
+ SystemName = "Vip",
+ FreeShipping = true
+ };
+ return Verify(_mapper.Map<CustomerGroupDto>(entity));
+ }
+
+ // ── Customer ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CustomerDto_ToEntity()
+ {
+ var dto = new CustomerDto {
+ Id = "cust-1",
+ Email = "[email protected]",
+ Username = "customer1",
+ Active = true
+ };
+ return Verify(_mapper.Map<Customer>(dto));
+ }
+
+ [TestMethod]
+ public Task Customer_ToDto_EmptyUserFields()
+ {
+ var entity = new Customer {
+ Id = "cust-1",
+ Email = "[email protected]",
+ Username = "customer1",
+ Active = true
+ };
+ return Verify(_mapper.Map<CustomerDto>(entity));
+ }
+
+ [TestMethod]
+ public Task Customer_ToDto_WithUserFields()
+ {
+ var entity = new Customer {
+ Id = "cust-1",
+ Email = "[email protected]",
+ Username = "customer1",
+ Active = true,
+ UserFields = [
+ new UserField { Key = "FirstName", Value = "John", StoreId = "" },
+ new UserField { Key = "LastName", Value = "Doe", StoreId = "" },
+ new UserField { Key = "Gender", Value = "M", StoreId = "" },
+ new UserField { Key = "City", Value = "New York", StoreId = "" },
+ new UserField { Key = "Company", Value = "Acme Corp", StoreId = "" },
+ new UserField { Key = "StreetAddress", Value = "123 Main St", StoreId = "" },
+ new UserField { Key = "StreetAddress2", Value = "Apt 4", StoreId = "" },
+ new UserField { Key = "ZipPostalCode", Value = "10001", StoreId = "" },
+ new UserField { Key = "CountryId", Value = "country-001", StoreId = "" },
+ new UserField { Key = "StateProvinceId", Value = "state-001", StoreId = "" },
+ new UserField { Key = "Phone", Value = "+1-555-0123", StoreId = "" },
+ new UserField { Key = "Fax", Value = "+1-555-0124", StoreId = "" },
+ new UserField { Key = "VatNumber", Value = "VAT123456", StoreId = "" },
+ new UserField { Key = "VatNumberStatusId", Value = "20", StoreId = "" }
+ ]
+ };
+ return Verify(_mapper.Map<CustomerDto>(entity));
+ }
+
+ // ── Picture ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task PictureDto_ToEntity()
+ {
+ var dto = new PictureDto {
+ Id = "pic-1",
+ MimeType = "image/jpeg",
+ SeoFilename = "product-image",
+ AltAttribute = "Product image",
+ TitleAttribute = "Product"
+ };
+ return Verify(_mapper.Map<Picture>(dto));
+ }
+
+ [TestMethod]
+ public Task Picture_ToDto()
+ {
+ var entity = new Picture {
+ Id = "pic-1",
+ MimeType = "image/jpeg",
+ SeoFilename = "product-image",
+ AltAttribute = "Product image",
+ TitleAttribute = "Product"
+ };
+ return Verify(_mapper.Map<PictureDto>(entity));
+ }
+
+ // ── ProductAttribute ──────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeDto_ToEntity()
+ {
+ var dto = new ProductAttributeDto {
+ Id = "pa-1",
+ Name = "Color",
+ Description = "Product color"
+ };
+ return Verify(_mapper.Map<ProductAttribute>(dto));
+ }
+
+ [TestMethod]
+ public Task ProductAttribute_ToDto()
+ {
+ var entity = new ProductAttribute {
+ Id = "pa-1",
+ Name = "Color",
+ Description = "Product color"
+ };
+ return Verify(_mapper.Map<ProductAttributeDto>(entity));
+ }
+
+ [TestMethod]
+ public Task PredefinedProductAttributeValue_ToDto()
+ {
+ var entity = new PredefinedProductAttributeValue {
+ Id = "ppav-1",
+ Name = "Red",
+ PriceAdjustment = 0,
+ WeightAdjustment = 0,
+ IsPreSelected = false,
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<PredefinedProductAttributeValueDto>(entity));
+ }
+
+ // ── ProductAttributeMapping ───────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeMappingDto_ToEntity()
+ {
+ var dto = new ProductAttributeMappingDto {
+ Id = "pam-1",
+ ProductAttributeId = "pa-1",
+ TextPrompt = "Choose color",
+ IsRequired = true,
+ AttributeControlTypeId = (AttributeControlType)1,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<ProductAttributeMapping>(dto));
+ }
+
+ [TestMethod]
+ public Task ProductAttributeMapping_ToDto()
+ {
+ var entity = new ProductAttributeMapping {
+ Id = "pam-1",
+ ProductAttributeId = "pa-1",
+ TextPrompt = "Choose color",
+ IsRequired = true,
+ AttributeControlTypeId = (AttributeControlType)1,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<ProductAttributeMappingDto>(entity));
+ }
+
+ // ── SpecificationAttribute ────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task SpecificationAttributeDto_ToEntity()
+ {
+ var dto = new SpecificationAttributeDto {
+ Id = "sa-1",
+ Name = "Material",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<SpecificationAttribute>(dto));
+ }
+
+ [TestMethod]
+ public Task SpecificationAttribute_ToDto()
+ {
+ var entity = new SpecificationAttribute {
+ Id = "sa-1",
+ Name = "Material",
+ DisplayOrder = 1
+ };
+ return Verify(_mapper.Map<SpecificationAttributeDto>(entity));
+ }
+
+ [TestMethod]
+ public Task SpecificationAttributeOption_ToDto()
+ {
+ var entity = new SpecificationAttributeOption {
+ Id = "sao-1",
+ Name = "Cotton",
+ DisplayOrder = 0,
+ ColorSquaresRgb = "#FFFFFF"
+ };
+ return Verify(_mapper.Map<SpecificationAttributeOptionDto>(entity));
+ }
+
+ // ── TierPrice ─────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductTierPriceDto_ToEntity()
+ {
+ var dto = new ProductTierPriceDto {
+ Id = "tp-1",
+ StoreId = "",
+ CustomerGroupId = "",
+ Quantity = 10,
+ Price = 9.99,
+ StartDateTimeUtc = null,
+ EndDateTimeUtc = null
+ };
+ return Verify(_mapper.Map<TierPrice>(dto));
+ }
+
+ [TestMethod]
+ public Task TierPrice_ToDto()
+ {
+ var entity = new TierPrice {
+ Id = "tp-1",
+ StoreId = "",
+ CustomerGroupId = "",
+ Quantity = 10,
+ Price = 9.99
+ };
+ return Verify(_mapper.Map<ProductTierPriceDto>(entity));
+ }
+
+ // ── Product ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductDto_ToEntity()
+ {
+ var dto = new ProductDto {
+ Id = "prod-1",
+ Name = "Test Product",
+ ShortDescription = "Short",
+ FullDescription = "Full description",
+ Sku = "SKU001",
+ Price = 29.99,
+ Published = true,
+ StockQuantity = 100,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<Product>(dto));
+ }
+
+ [TestMethod]
+ public Task Product_ToDto()
+ {
+ var entity = new Product {
+ Id = "prod-1",
+ Name = "Test Product",
+ ShortDescription = "Short",
+ FullDescription = "Full description",
+ Sku = "SKU001",
+ Price = 29.99,
+ Published = true,
+ StockQuantity = 100,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<ProductDto>(entity));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_NullConditions_NotApplied.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_NullConditions_NotApplied.verified.txt
new file mode 100644
index 000000000..cc56a03d3
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_NullConditions_NotApplied.verified.txt
@@ -0,0 +1,12 @@
+{
+ Name: Partial Brand,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ IncludeInMenu: false,
+ DefaultSort: -1,
+ Published: false,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_WithNullableValues.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_WithNullableValues.verified.txt
new file mode 100644
index 000000000..6926b2deb
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.BrandDto_ToEntity_WithNullableValues.verified.txt
@@ -0,0 +1,19 @@
+{
+ Name: Nike,
+ Description: Sports brand,
+ BrandLayoutId: layout-1,
+ MetaTitle: Nike,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ ShowOnHomePage: true,
+ IncludeInMenu: true,
+ ExternalId: ext-001,
+ Published: true,
+ DisplayOrder: 1,
+ LimitedToGroups: false,
+ SeName: nike,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: brand-export-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_NullConditions_NotApplied.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_NullConditions_NotApplied.verified.txt
new file mode 100644
index 000000000..3277377dd
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_NullConditions_NotApplied.verified.txt
@@ -0,0 +1,15 @@
+{
+ Name: Partial Category,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ ShowOnSearchBox: false,
+ IncludeInMenu: false,
+ Published: false,
+ DefaultSort: -1,
+ HideOnCatalog: false,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_WithNullableValues.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_WithNullableValues.verified.txt
new file mode 100644
index 000000000..243d5b00c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CategoryDto_ToEntity_WithNullableValues.verified.txt
@@ -0,0 +1,23 @@
+{
+ Name: Electronics,
+ Description: Electronic products,
+ CategoryLayoutId: layout-1,
+ MetaKeywords: electronics, gadgets,
+ MetaDescription: Best electronics,
+ MetaTitle: Electronics,
+ ParentCategoryId: ,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ ShowOnHomePage: true,
+ FeaturedProductsOnHomePage: false,
+ ShowOnSearchBox: false,
+ IncludeInMenu: true,
+ Published: true,
+ HideOnCatalog: false,
+ LimitedToGroups: false,
+ SeName: electronics,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: cat-export-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_NullConditions_NotApplied.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_NullConditions_NotApplied.verified.txt
new file mode 100644
index 000000000..e6b76031d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_NullConditions_NotApplied.verified.txt
@@ -0,0 +1,13 @@
+{
+ Name: Partial Collection,
+ AllowCustomersToSelectPageSize: false,
+ ShowOnHomePage: false,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: false,
+ DefaultSort: -1,
+ Published: false,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_WithNullableValues.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_WithNullableValues.verified.txt
new file mode 100644
index 000000000..859e6f611
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.CollectionDto_ToEntity_WithNullableValues.verified.txt
@@ -0,0 +1,20 @@
+{
+ Name: Summer 2025,
+ Description: Summer items,
+ CollectionLayoutId: layout-1,
+ MetaTitle: Summer 2025,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ ShowOnHomePage: true,
+ FeaturedProductsOnHomePage: false,
+ IncludeInMenu: true,
+ Published: true,
+ DisplayOrder: 3,
+ ExternalId: ext-col-001,
+ LimitedToGroups: false,
+ SeName: summer-2025,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: col-export-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_BasicProperties.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_BasicProperties.verified.txt
new file mode 100644
index 000000000..cf7ca9597
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_BasicProperties.verified.txt
@@ -0,0 +1,45 @@
+{
+ VisibleIndividually: true,
+ Name: Test Product,
+ ShortDescription: Short,
+ FullDescription: Full description,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: SKU001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 100,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 29.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: true,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: prod-export-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_ExistingIdPreservedWhenEmpty.verified.txt b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_ExistingIdPreservedWhenEmpty.verified.txt
new file mode 100644
index 000000000..52885385b
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.ProductDto_ToEntity_ExistingIdPreservedWhenEmpty.verified.txt
@@ -0,0 +1,40 @@
+{
+ VisibleIndividually: false,
+ Name: No Id Product,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: false,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ UpdatedOnUtc: DateTime_1,
+ Id: existing-id
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.cs b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.cs
new file mode 100644
index 000000000..b5242524c
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Catalog/ExportImportMappingTests.cs
@@ -0,0 +1,177 @@
+using Grand.Mapping;
+using Grand.Business.Catalog.Services.ExportImport.Mapper;
+using Grand.Business.Core.Dto;
+using Grand.Domain.Catalog;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+
+namespace Grand.Mapping.Tests.Catalog;
+
+/// <summary>
+/// Tests for ExportImport mapping profiles.
+/// NOTE: These profiles set UpdatedOnUtc = DateTime.UtcNow via MapFrom.
+/// Verify automatically scrubs DateTime values, so snapshots remain stable.
+/// </summary>
+[TestClass]
+public class ExportImportMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<CategoryProfile>();
+ cfg.AddProfile<BrandProfile>();
+ cfg.AddProfile<CollectionProfile>();
+ cfg.AddProfile<ProductProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Category ──────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CategoryDto_ToEntity_WithNullableValues()
+ {
+ var dto = new CategoryDto {
+ Id = "cat-export-1",
+ Name = "Electronics",
+ SeName = "electronics",
+ Description = "Electronic products",
+ MetaTitle = "Electronics",
+ MetaKeywords = "electronics, gadgets",
+ MetaDescription = "Best electronics",
+ CategoryLayoutId = "layout-1",
+ ParentCategoryId = "",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ ShowOnHomePage = true,
+ FeaturedProductsOnHomePage = false,
+ ShowOnSearchBox = false,
+ SearchBoxDisplayOrder = 0,
+ IncludeInMenu = true,
+ DefaultSort = 0,
+ HideOnCatalog = false,
+ Published = true,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<Category>(dto));
+ }
+
+ [TestMethod]
+ public Task CategoryDto_ToEntity_NullConditions_NotApplied()
+ {
+ // When nullable fields are null, the mapping condition is false, so
+ // the destination keeps its default values for those members.
+ var dto = new CategoryDto {
+ Name = "Partial Category"
+ // All nullable properties are null → conditions false → not mapped
+ };
+ return Verify(_mapper.Map<Category>(dto));
+ }
+
+ // ── Brand ─────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task BrandDto_ToEntity_WithNullableValues()
+ {
+ var dto = new BrandDto {
+ Id = "brand-export-1",
+ Name = "Nike",
+ SeName = "nike",
+ Description = "Sports brand",
+ MetaTitle = "Nike",
+ BrandLayoutId = "layout-1",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ ShowOnHomePage = true,
+ IncludeInMenu = true,
+ DefaultSort = 0,
+ Published = true,
+ DisplayOrder = 1,
+ ExternalId = "ext-001"
+ };
+ return Verify(_mapper.Map<Brand>(dto));
+ }
+
+ [TestMethod]
+ public Task BrandDto_ToEntity_NullConditions_NotApplied()
+ {
+ var dto = new BrandDto {
+ Name = "Partial Brand"
+ };
+ return Verify(_mapper.Map<Brand>(dto));
+ }
+
+ // ── Collection ────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task CollectionDto_ToEntity_WithNullableValues()
+ {
+ var dto = new CollectionDto {
+ Id = "col-export-1",
+ Name = "Summer 2025",
+ SeName = "summer-2025",
+ Description = "Summer items",
+ MetaTitle = "Summer 2025",
+ CollectionLayoutId = "layout-1",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ ShowOnHomePage = true,
+ FeaturedProductsOnHomePage = false,
+ IncludeInMenu = true,
+ DefaultSort = 0,
+ Published = true,
+ DisplayOrder = 3,
+ ExternalId = "ext-col-001"
+ };
+ return Verify(_mapper.Map<Collection>(dto));
+ }
+
+ [TestMethod]
+ public Task CollectionDto_ToEntity_NullConditions_NotApplied()
+ {
+ var dto = new CollectionDto {
+ Name = "Partial Collection"
+ };
+ return Verify(_mapper.Map<Collection>(dto));
+ }
+
+ // ── Product ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductDto_ToEntity_BasicProperties()
+ {
+ // ProductProfile has many nullable conditions; test with a minimal set
+ var dto = new Grand.Business.Core.Dto.ProductDto {
+ Id = "prod-export-1",
+ Name = "Test Product",
+ ShortDescription = "Short",
+ FullDescription = "Full description",
+ Sku = "SKU001",
+ Published = true,
+ VisibleIndividually = true,
+ ShowOnHomePage = false,
+ Price = 29.99,
+ StockQuantity = 100,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<Product>(dto));
+ }
+
+ [TestMethod]
+ public Task ProductDto_ToEntity_ExistingIdPreservedWhenEmpty()
+ {
+ // When Id is null/empty, the Condition prevents overwriting the existing Id.
+ var dto = new Grand.Business.Core.Dto.ProductDto {
+ Id = "", // empty → condition false → Id not overwritten
+ Name = "No Id Product"
+ };
+ var destination = new Product { Id = "existing-id" };
+ return Verify(_mapper.Map(dto, destination));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/Grand.Mapping.Tests.csproj b/src/Tests/Grand.Mapping.Tests/Grand.Mapping.Tests.csproj
new file mode 100644
index 000000000..83d91662e
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Grand.Mapping.Tests.csproj
@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <Import Project="..\..\Build\Grand.Common.props" />
+ <PropertyGroup>
+ <IsPackable>false</IsPackable>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" />
+ <PackageReference Include="Moq" />
+ <PackageReference Include="MSTest.TestAdapter" />
+ <PackageReference Include="MSTest.TestFramework" />
+ <PackageReference Include="Verify.MSTest" />
+ <PackageReference Include="coverlet.collector">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\Web\Grand.Web.AdminShared\Grand.Web.AdminShared.csproj" />
+ <ProjectReference Include="..\..\Modules\Grand.Module.Api\Grand.Module.Api.csproj" />
+ <ProjectReference Include="..\..\Web\Grand.Web.Vendor\Grand.Web.Vendor.csproj" />
+ <ProjectReference Include="..\..\Business\Grand.Business.Catalog\Grand.Business.Catalog.csproj" />
+ </ItemGroup>
+
+</Project>
diff --git a/src/Tests/Grand.Mapping.Tests/TestMappingHelpers.cs b/src/Tests/Grand.Mapping.Tests/TestMappingHelpers.cs
new file mode 100644
index 000000000..03d201a39
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/TestMappingHelpers.cs
@@ -0,0 +1,17 @@
+using Grand.Mapping;
+
+namespace Grand.Mapping.Tests;
+
+internal static class TestMappingHelpers
+{
+ // Preserves: _mapper.Map<TDest>(source)
+ public static TDest Map<TDest>(this IMapper mapper, object source) where TDest : new()
+ {
+ if (source is null) return default!;
+ var mapMethod = typeof(IMapper)
+ .GetMethods()
+ .First(m => m.Name == nameof(IMapper.Map) && m.GetParameters().Length == 1)
+ .MakeGenericMethod(source.GetType(), typeof(TDest));
+ return (TDest)mapMethod.Invoke(mapper, [source])!;
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Address_ToVendorAddressModel.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Address_ToVendorAddressModel.verified.txt
new file mode 100644
index 000000000..8401f5b8b
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Address_ToVendorAddressModel.verified.txt
@@ -0,0 +1,38 @@
+{
+ FirstName: Jane,
+ LastName: Smith,
+ CountryId: GB,
+ City: Tradeville,
+ Address1: 42 Commerce St,
+ ZipPostalCode: 99001,
+ PhoneNumber: 555-1234,
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ Id: addr-v-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeCombination_ToVendorModel.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeCombination_ToVendorModel.verified.txt
new file mode 100644
index 000000000..8d4ae37e4
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeCombination_ToVendorModel.verified.txt
@@ -0,0 +1,8 @@
+{
+ Id: pac-v-1,
+ StockQuantity: 5,
+ AllowOutOfStockOrders: false,
+ Sku: COMB-SKU,
+ NotifyAdminForQuantityBelow: 1,
+ UseMultipleWarehouses: false
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeMapping_ToVendorModel.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeMapping_ToVendorModel.verified.txt
new file mode 100644
index 000000000..2e5ae0370
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.ProductAttributeMapping_ToVendorModel.verified.txt
@@ -0,0 +1,12 @@
+{
+ ProductAttributeId: pa-1,
+ TextPrompt: Choose size,
+ IsRequired: true,
+ ShowOnCatalogPage: false,
+ AttributeControlTypeId: DropdownList,
+ Combination: false,
+ ShouldHaveValues: false,
+ ValidationRulesAllowed: false,
+ ConditionAllowed: false,
+ Id: pam-v-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Product_ToVendorProductModel.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Product_ToVendorProductModel.verified.txt
new file mode 100644
index 000000000..b7826ea54
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Product_ToVendorProductModel.verified.txt
@@ -0,0 +1,57 @@
+{
+ Id: prod-v-1,
+ ProductTypeId: 5,
+ AuctionEnded: false,
+ VisibleIndividually: false,
+ Name: Vendor Product,
+ ShortDescription: Short desc,
+ FullDescription: Full description,
+ AllowCustomerReviews: false,
+ Sku: VSKU001,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsRecurring: false,
+ CalendarModel: {
+ Interval: 1,
+ IncBothDate: false,
+ Quantity: 1,
+ Monday: false,
+ Tuesday: false,
+ Wednesday: false,
+ Thursday: false,
+ Friday: false,
+ Saturday: false,
+ Sunday: false
+ },
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 50,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 49.99,
+ OldPrice: 59.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ Weight: 1.5,
+ DisplayOrder: 1,
+ Published: true,
+ AddPictureModel: {
+ IsDefault: false
+ },
+ CopyProductModel: {
+ CopyImages: false,
+ Published: false
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorModel_ToVendor.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorModel_ToVendor.verified.txt
new file mode 100644
index 000000000..77b3c9e2d
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorModel_ToVendor.verified.txt
@@ -0,0 +1,17 @@
+{
+ Name: Updated Vendor,
+ Description: Updated description,
+ Active: false,
+ Deleted: false,
+ MetaKeywords: vendor, updated,
+ MetaTitle: Updated Vendor,
+ PageSize: 12,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ AllowCustomerReviews: false,
+ Address: {
+ Id: ObjectId_1
+ },
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorProductModel_ToProduct.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorProductModel_ToProduct.verified.txt
new file mode 100644
index 000000000..0cb803d5f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.VendorProductModel_ToProduct.verified.txt
@@ -0,0 +1,44 @@
+{
+ VisibleIndividually: false,
+ Name: New Product,
+ ShortDescription: Short,
+ FullDescription: Full,
+ ShowOnHomePage: false,
+ BestSeller: false,
+ AllowCustomerReviews: false,
+ Sku: SKU002,
+ IsGiftVoucher: false,
+ RequireOtherProducts: false,
+ AutoAddRequiredProducts: false,
+ IsDownload: false,
+ UnlimitedDownloads: false,
+ HasSampleDownload: false,
+ HasUserAgreement: false,
+ IsRecurring: false,
+ IncBothDate: false,
+ IsShipEnabled: false,
+ IsFreeShipping: false,
+ ShipSeparately: false,
+ IsTaxExempt: false,
+ IsTele: false,
+ UseMultipleWarehouses: false,
+ StockQuantity: 25,
+ StockAvailability: false,
+ DisplayStockQuantity: false,
+ LowStock: false,
+ AllowOutOfStockSubscriptions: false,
+ NotReturnable: false,
+ DisableBuyButton: false,
+ DisableWishlistButton: false,
+ AvailableForPreOrder: false,
+ CallForPrice: false,
+ Price: 39.99,
+ EnteredPrice: false,
+ BasepriceEnabled: false,
+ MarkAsNew: false,
+ AuctionEnded: false,
+ Published: true,
+ LimitedToGroups: false,
+ LimitedToStores: false,
+ Id: ObjectId_1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Vendor_ToVendorModel.verified.txt b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Vendor_ToVendorModel.verified.txt
new file mode 100644
index 000000000..5a8dad417
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.Vendor_ToVendorModel.verified.txt
@@ -0,0 +1,43 @@
+{
+ Name: Test Vendor,
+ Description: Quality products,
+ MetaKeywords: vendor, test,
+ MetaDescription: Best vendor,
+ MetaTitle: Test Vendor,
+ SeName: test-vendor,
+ PageSize: 6,
+ AllowCustomersToSelectPageSize: true,
+ PageSizeOptions: 6, 12, 24,
+ Address: {
+ NameEnabled: false,
+ FirstNameEnabled: false,
+ FirstNameRequired: false,
+ LastNameEnabled: false,
+ LastNameRequired: false,
+ EmailEnabled: false,
+ EmailRequired: false,
+ CompanyEnabled: false,
+ CompanyRequired: false,
+ VatNumberEnabled: false,
+ VatNumberRequired: false,
+ CountryEnabled: false,
+ StateProvinceEnabled: false,
+ CityEnabled: false,
+ CityRequired: false,
+ StreetAddressEnabled: false,
+ StreetAddressRequired: false,
+ StreetAddress2Enabled: false,
+ StreetAddress2Required: false,
+ ZipPostalCodeEnabled: false,
+ ZipPostalCodeRequired: false,
+ PhoneEnabled: false,
+ PhoneRequired: false,
+ FaxEnabled: false,
+ FaxRequired: false,
+ NoteEnabled: false,
+ AddressTypeEnabled: false,
+ Id: ObjectId_1
+ },
+ Id: vendor-1
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.cs b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.cs
new file mode 100644
index 000000000..da92f106f
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/Vendor/VendorMappingTests.cs
@@ -0,0 +1,160 @@
+using Grand.Mapping;
+using Grand.Domain.Catalog;
+using Grand.Domain.Common;
+using Grand.Web.Vendor.Mapper;
+using Grand.Web.Vendor.Models.Catalog;
+using Grand.Web.Vendor.Models.Common;
+using Grand.Web.Vendor.Models.Vendor;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using VerifyMSTest;
+using AddressProfile = Grand.Web.Vendor.Mapper.AddressProfile;
+using ProductProfile = Grand.Web.Vendor.Mapper.ProductProfile;
+using VendorProfile = Grand.Web.Vendor.Mapper.VendorProfile;
+
+namespace Grand.Mapping.Tests.Vendor;
+
+[TestClass]
+public class VendorMappingTests : VerifyBase
+{
+ private IMapper _mapper;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.AddProfile<AddressProfile>();
+ cfg.AddProfile<ProductProfile>();
+ cfg.AddProfile<VendorProfile>();
+ });
+ _mapper = config.CreateMapper();
+ }
+
+ // ── Address ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Address_ToVendorAddressModel()
+ {
+ var entity = new Address {
+ Id = "addr-v-1",
+ FirstName = "Jane",
+ LastName = "Smith",
+ Email = "[email protected]",
+ PhoneNumber = "555-1234",
+ Address1 = "42 Commerce St",
+ City = "Tradeville",
+ ZipPostalCode = "99001",
+ CountryId = "GB"
+ };
+ return Verify(_mapper.Map<AddressModel>(entity));
+ }
+
+ // ── Vendor ────────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Vendor_ToVendorModel()
+ {
+ var entity = new Grand.Domain.Vendors.Vendor {
+ Id = "vendor-1",
+ Name = "Test Vendor",
+ SeName = "test-vendor",
+ Description = "Quality products",
+ Email = "[email protected]",
+ MetaTitle = "Test Vendor",
+ MetaKeywords = "vendor, test",
+ MetaDescription = "Best vendor",
+ Active = true,
+ Deleted = false,
+ DisplayOrder = 0,
+ PageSize = 6,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24",
+ AllowCustomerReviews = true
+ };
+ return Verify(_mapper.Map<VendorModel>(entity));
+ }
+
+ [TestMethod]
+ public Task VendorModel_ToVendor()
+ {
+ var model = new VendorModel {
+ Name = "Updated Vendor",
+ Description = "Updated description",
+ Email = "[email protected]",
+ MetaTitle = "Updated Vendor",
+ MetaKeywords = "vendor, updated",
+ PageSize = 12,
+ AllowCustomersToSelectPageSize = true,
+ PageSizeOptions = "6, 12, 24"
+ };
+ return Verify(_mapper.Map<Grand.Domain.Vendors.Vendor>(model));
+ }
+
+ // ── Product ───────────────────────────────────────────────────────────────
+
+ [TestMethod]
+ public Task Product_ToVendorProductModel()
+ {
+ var entity = new Product {
+ Id = "prod-v-1",
+ Name = "Vendor Product",
+ ShortDescription = "Short desc",
+ FullDescription = "Full description",
+ Sku = "VSKU001",
+ Price = 49.99,
+ OldPrice = 59.99,
+ Published = true,
+ StockQuantity = 50,
+ Weight = 1.5,
+ DisplayOrder = 1,
+ ProductTypeId = (ProductType)5
+ };
+ return Verify(_mapper.Map<ProductModel>(entity));
+ }
+
+ [TestMethod]
+ public Task VendorProductModel_ToProduct()
+ {
+ var model = new ProductModel {
+ Name = "New Product",
+ ShortDescription = "Short",
+ FullDescription = "Full",
+ Sku = "SKU002",
+ Price = 39.99,
+ Published = true,
+ StockQuantity = 25
+ };
+ return Verify(_mapper.Map<Product>(model));
+ }
+
+ // ── ProductAttributeMapping ───────────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeMapping_ToVendorModel()
+ {
+ var entity = new ProductAttributeMapping {
+ Id = "pam-v-1",
+ ProductAttributeId = "pa-1",
+ TextPrompt = "Choose size",
+ IsRequired = true,
+ AttributeControlTypeId = (AttributeControlType)1,
+ DisplayOrder = 0
+ };
+ return Verify(_mapper.Map<ProductModel.ProductAttributeMappingModel>(entity));
+ }
+
+ // ── ProductAttributeCombination ───────────────────────────────────────────
+
+ [TestMethod]
+ public Task ProductAttributeCombination_ToVendorModel()
+ {
+ var entity = new ProductAttributeCombination {
+ Id = "pac-v-1",
+ Sku = "COMB-SKU",
+ StockQuantity = 5,
+ AllowOutOfStockOrders = false,
+ OverriddenPrice = null,
+ NotifyAdminForQuantityBelow = 1
+ };
+ return Verify(_mapper.Map<ProductAttributeCombinationModel>(entity));
+ }
+}
diff --git a/src/Tests/Grand.Mapping.Tests/VerifyConfig.cs b/src/Tests/Grand.Mapping.Tests/VerifyConfig.cs
new file mode 100644
index 000000000..9f5225eb3
--- /dev/null
+++ b/src/Tests/Grand.Mapping.Tests/VerifyConfig.cs
@@ -0,0 +1,33 @@
+using System.Collections.Concurrent;
+using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
+
+namespace Grand.Mapping.Tests;
+
+public static class VerifyConfig
+{
+ private static readonly Regex ObjectIdPattern = new(@"\b[0-9a-f]{24}\b", RegexOptions.Compiled);
+
+ [ModuleInitializer]
+ public static void Initialize()
+ {
+ // Replace auto-generated MongoDB ObjectIds with deterministic placeholders,
+ // the same way Verify.ScrubInlineGuids() works for standard GUIDs.
+ VerifierSettings.AddScrubber((sb) =>
+ {
+ var seen = new Dictionary<string, string>();
+ var counter = 0;
+ var result = ObjectIdPattern.Replace(sb.ToString(), m =>
+ {
+ if (!seen.TryGetValue(m.Value, out var label))
+ {
+ label = $"ObjectId_{++counter}";
+ seen[m.Value] = label;
+ }
+ return label;
+ });
+ sb.Clear();
+ sb.Append(result);
+ });
+ }
+}
diff --git a/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs
index f8eaafc0d..28344ee67 100644
--- a/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs
+++ b/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.System.Admin;
using Grand.Domain.Admin;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Extensions/Mapping/DiscountMappingExtensions.cs b/src/Web/Grand.Web.AdminShared/Extensions/Mapping/DiscountMappingExtensions.cs
index 1a2ff8b32..2004bb700 100644
--- a/src/Web/Grand.Web.AdminShared/Extensions/Mapping/DiscountMappingExtensions.cs
+++ b/src/Web/Grand.Web.AdminShared/Extensions/Mapping/DiscountMappingExtensions.cs
@@ -11,8 +11,8 @@ public static class DiscountMappingExtensions
public static DiscountModel ToModel(this Discount entity, IDateTimeService dateTimeService)
{
var discount = entity.MapTo<Discount, DiscountModel>();
- discount.StartDate = (DateTime)entity.StartDateUtc.ConvertToUserTime(dateTimeService);
- discount.EndDate = (DateTime)entity.EndDateUtc.ConvertToUserTime(dateTimeService);
+ discount.StartDate = entity.StartDateUtc.ConvertToUserTime(dateTimeService);
+ discount.EndDate = entity.EndDateUtc.ConvertToUserTime(dateTimeService);
return discount;
}
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeProfile.cs
index e218417f3..381e921cb 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Common;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeValueProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeValueProfile.cs
index a73c7abc9..d2c4896e5 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeValueProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/AddressAttributeValueProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Common;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/AddressProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/AddressProfile.cs
index eebd34e5d..1735b03c0 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/AddressProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/AddressProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Common;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/AddressSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/AddressSettingsProfile.cs
index acdd0ca87..7ce3aaace 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/AddressSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/AddressSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/AdminSearchSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/AdminSearchSettingsProfile.cs
index 57398b914..6efc3e86b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/AdminSearchSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/AdminSearchSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Admin;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/BlogCategoryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/BlogCategoryProfile.cs
index c70089311..ef6fe126b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/BlogCategoryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/BlogCategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Blogs;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Blogs;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/BlogPostProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/BlogPostProfile.cs
index 9cda0e7f8..dbb909669 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/BlogPostProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/BlogPostProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Blogs;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/BlogSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/BlogSettingsProfile.cs
index 825a0ad26..2e801d937 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/BlogSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/BlogSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Blogs;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/BrandLayoutProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/BrandLayoutProfile.cs
index 51c26ad35..2a93cad8c 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/BrandLayoutProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/BrandLayoutProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Layouts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/BrandProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/BrandProfile.cs
index 8b1645c05..fa54231dc 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/BrandProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/BrandProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CampaignProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CampaignProfile.cs
index fcd0f4d53..83e15659a 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CampaignProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CampaignProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CaptchaSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CaptchaSettingsProfile.cs
index 7e0f38870..0c8af6482 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CaptchaSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CaptchaSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CatalogSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CatalogSettingsProfile.cs
index 6c3ba604e..772892864 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CatalogSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CatalogSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CategoryLayoutProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CategoryLayoutProfile.cs
index 90db7a281..26ee90404 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CategoryLayoutProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CategoryLayoutProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Layouts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CategoryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CategoryProfile.cs
index fbc08e403..e822d3dba 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CategoryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CheckoutAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CheckoutAttributeProfile.cs
index fdcc68321..b8983688f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CheckoutAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CheckoutAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Orders;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CollectionLayoutProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CollectionLayoutProfile.cs
index 586792f4d..854e05e4e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CollectionLayoutProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CollectionLayoutProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Layouts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CollectionProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CollectionProfile.cs
index 045c3e0c7..12f8be825 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CollectionProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CollectionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CommonSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CommonSettingsProfile.cs
index a7ff344bb..e079f423a 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CommonSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CommonSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ContactAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ContactAttributeProfile.cs
index 19c3706ab..1e3ba5769 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ContactAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ContactAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ContactUsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ContactUsProfile.cs
index 4e2b6f1d1..097509a51 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ContactUsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ContactUsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CountryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CountryProfile.cs
index c6b2f6dbe..9b311765b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CountryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CountryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CourseLessonProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CourseLessonProfile.cs
index 1469385da..f19ab117f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CourseLessonProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CourseLessonProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Courses;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Courses;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CourseLevelProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CourseLevelProfile.cs
index 0fe9021cf..f84680c7c 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CourseLevelProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CourseLevelProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Courses;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Courses;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CourseProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CourseProfile.cs
index 0b1f63ff2..e2020679b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CourseProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CourseProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Courses;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Courses;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CourseSubjectProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CourseSubjectProfile.cs
index 1ebec2ca8..85d98e36f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CourseSubjectProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CourseSubjectProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Courses;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Courses;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CurrencyProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CurrencyProfile.cs
index b13bd5d69..88ec83bf2 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CurrencyProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CurrencyProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeProfile.cs
index b92aeeb4b..73c274f66 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeValueProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeValueProfile.cs
index 5a60600e1..6a83bbeae 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeValueProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CustomerAttributeValueProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CustomerGroupProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CustomerGroupProfile.cs
index 8fe3911bc..8ee19541a 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CustomerGroupProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CustomerGroupProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CustomerSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CustomerSettingsProfile.cs
index 38b442cef..620f7da0d 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CustomerSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CustomerSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/CustomerTagProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/CustomerTagProfile.cs
index 71a7d552e..e7c9d577c 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/CustomerTagProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/CustomerTagProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/DeliveryDateProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/DeliveryDateProfile.cs
index 6a3c0336a..4a37aa439 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/DeliveryDateProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/DeliveryDateProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/DiscountProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/DiscountProfile.cs
index 667b904c3..229730e9d 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/DiscountProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/DiscountProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Discounts;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Discounts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/DocumentProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/DocumentProfile.cs
index 087e3faf1..7e4728bb3 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/DocumentProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/DocumentProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Documents;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Documents;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/DocumentTypeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/DocumentTypeProfile.cs
index 430a20eab..b644016e4 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/DocumentTypeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/DocumentTypeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Documents;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Documents;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/EmailAccountProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/EmailAccountProfile.cs
index 45f8b51ee..f0e257525 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/EmailAccountProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/EmailAccountProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ExternalAuthenticationMethodProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ExternalAuthenticationMethodProfile.cs
index e57592a8c..b30b6ded6 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ExternalAuthenticationMethodProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ExternalAuthenticationMethodProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.Authentication;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.ExternalAuthentication;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/GiftVoucherProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/GiftVoucherProfile.cs
index 071d983d5..406c876b5 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/GiftVoucherProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/GiftVoucherProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Orders;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseCategoryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseCategoryProfile.cs
index b4f11d62b..005f24fd4 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseCategoryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseCategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Knowledgebase;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Knowledgebase;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseSettingsProfile.cs
index aa0915b58..4e1abe2ea 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/KnowledgebaseSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Knowledgebase;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/LanguageProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/LanguageProfile.cs
index a3b64c08e..2fdfaf9bb 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/LanguageProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/LanguageProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Localization;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Localization;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/LoyaltyPointsSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/LoyaltyPointsSettingsProfile.cs
index c67f8d3d5..c150dd680 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/LoyaltyPointsSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/LoyaltyPointsSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MeasureDimensionProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MeasureDimensionProfile.cs
index d6ab12f3f..65a69c979 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MeasureDimensionProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MeasureDimensionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MeasureUnitProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MeasureUnitProfile.cs
index aa2484b93..40e7bc5ee 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MeasureUnitProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MeasureUnitProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MeasureWeightProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MeasureWeightProfile.cs
index 83625d1d0..e7a7fcc80 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MeasureWeightProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MeasureWeightProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MediaSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MediaSettingsProfile.cs
index 7514f3a85..f5335f625 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MediaSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MediaSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Media;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MenuItemSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MenuItemSettingsProfile.cs
index e7f5152d2..27521626f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MenuItemSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MenuItemSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MenuProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MenuProfile.cs
index 8f572433c..5d484c903 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MenuProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MenuProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Admin;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Menu;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnActionProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnActionProfile.cs
index 96fa13afb..e03021761 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnActionProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnActionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnReasonProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnReasonProfile.cs
index dd1bfe4a0..607a3cbf5 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnReasonProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnReasonProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/MessageTemplateProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/MessageTemplateProfile.cs
index 2e4aa16ba..1f309da8b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/MessageTemplateProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/MessageTemplateProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/NewsItemProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/NewsItemProfile.cs
index 29ec30a2f..268340239 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/NewsItemProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/NewsItemProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.News;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/NewsLetterSubscriptionProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/NewsLetterSubscriptionProfile.cs
index e22d84a16..69c33411d 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/NewsLetterSubscriptionProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/NewsLetterSubscriptionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/NewsSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/NewsSettingsProfile.cs
index 752a50e88..e9b0060f8 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/NewsSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/NewsSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.News;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/NewsletterCategoryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/NewsletterCategoryProfile.cs
index bfbfb5bf2..4d02ef4d3 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/NewsletterCategoryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/NewsletterCategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/OrderSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/OrderSettingsProfile.cs
index 1fb9bc5d7..ecfe54d30 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/OrderSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/OrderSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/OrderStatusProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/OrderStatusProfile.cs
index 90a975d9e..f11f017b2 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/OrderStatusProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/OrderStatusProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Orders;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PageLayoutProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PageLayoutProfile.cs
index adb92683a..1a5f6a128 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PageLayoutProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PageLayoutProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Pages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Layouts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PageProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PageProfile.cs
index 17b75dc40..92e810d93 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PageProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PageProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Pages;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PaymentMethodProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PaymentMethodProfile.cs
index bc3bf03f6..ff7f9792b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PaymentMethodProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PaymentMethodProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Payments;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PaymentSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PaymentSettingsProfile.cs
index f05f6b894..84d8e4c31 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PaymentSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PaymentSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Payments;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Payments;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PdfSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PdfSettingsProfile.cs
index d731cb9c1..8bf5ca104 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PdfSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PdfSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PermissionProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PermissionProfile.cs
index de20d0df8..00e249ae5 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PermissionProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PermissionProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Permissions;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Permissions;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PickupPointProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PickupPointProfile.cs
index 3eec8ccc2..2f3458642 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PickupPointProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PickupPointProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PluginDescriptorProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PluginDescriptorProfile.cs
index 66811a366..e34bdff5a 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PluginDescriptorProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PluginDescriptorProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Infrastructure.Mapper;
using Grand.Infrastructure.Plugins;
using Grand.Web.AdminShared.Models.Plugins;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PredefinedProductAttributeValueProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PredefinedProductAttributeValueProfile.cs
index 081f9a2e4..eb188adcd 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PredefinedProductAttributeValueProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PredefinedProductAttributeValueProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeCombinationProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeCombinationProfile.cs
index 33e0bf9e3..25549b00f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeCombinationProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeCombinationProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeMappingProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeMappingProfile.cs
index d8f749e5d..cfe510ba1 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeMappingProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeMappingProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeProfile.cs
index 89173d25d..f463cff82 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductProfile.cs
index 1dc5dd187..144cec048 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductReviewProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductReviewProfile.cs
index bf40836f5..0dcb2946f 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductReviewProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductReviewProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductSpecificationProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductSpecificationProfile.cs
index 1e8481921..880402cd4 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductSpecificationProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductSpecificationProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ProductlayoutProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ProductlayoutProfile.cs
index 18f5cb52b..d45848e6e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ProductlayoutProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ProductlayoutProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Layouts;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/PushNotificationsSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/PushNotificationsSettingsProfile.cs
index 8e40e3e4f..a38e82b44 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/PushNotificationsSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/PushNotificationsSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.PushNotifications;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/QueuedEmailProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/QueuedEmailProfile.cs
index 314922d22..44afcc99a 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/QueuedEmailProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/QueuedEmailProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/SalesEmployeeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/SalesEmployeeProfile.cs
index a1fb60bb5..e8816d1ed 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/SalesEmployeeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/SalesEmployeeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ScheduleTaskProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ScheduleTaskProfile.cs
index 7e993f22c..266498f59 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ScheduleTaskProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ScheduleTaskProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Tasks;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Tasks;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/SeoSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/SeoSettingsProfile.cs
index 566d8959b..36caa9c34 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/SeoSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/SeoSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Seo;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs
index 68f29a7c3..53c02f22e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ShippingRateComputationMethodProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ShippingRateComputationMethodProfile.cs
index a42d39f71..f9d071500 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ShippingRateComputationMethodProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ShippingRateComputationMethodProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ShippingSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ShippingSettingsProfile.cs
index 15720c7cd..7dbc787b3 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ShippingSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ShippingSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ShoppingCartSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ShoppingCartSettingsProfile.cs
index 4ad05d7c5..9e93185e3 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/ShoppingCartSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/ShoppingCartSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Orders;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/SpecificationAttributeProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/SpecificationAttributeProfile.cs
index 29935859b..773c14ca6 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/SpecificationAttributeProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/SpecificationAttributeProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/StateProvinceProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/StateProvinceProfile.cs
index bccd3dbc3..f47539e7e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/StateProvinceProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/StateProvinceProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/StoreInformationSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/StoreInformationSettingsProfile.cs
index c56bf211e..684cf3d55 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/StoreInformationSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/StoreInformationSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Stores;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/StoreProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/StoreProfile.cs
index bf91508d3..800bc75a2 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/StoreProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/StoreProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Stores;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Stores;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/TaxCategoryProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/TaxCategoryProfile.cs
index 8c63c6aea..0eff01989 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/TaxCategoryProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/TaxCategoryProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Tax;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Tax;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/TaxProviderProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/TaxProviderProfile.cs
index 237b505d2..df5f9fab1 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/TaxProviderProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/TaxProviderProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.Catalog.Tax;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Tax;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/TaxSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/TaxSettingsProfile.cs
index 691199386..a77f313c0 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/TaxSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/TaxSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Tax;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Tax;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/TierPriceProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/TierPriceProfile.cs
index 122c992e7..c9897a15b 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/TierPriceProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/TierPriceProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Catalog;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/UserApiProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/UserApiProfile.cs
index 0c50983d1..f294f6107 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/UserApiProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/UserApiProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Customers;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Customers;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/VendorProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/VendorProfile.cs
index e6cb42a9a..6af9f959e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/VendorProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/VendorProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Vendors;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/VendorSettingsProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/VendorSettingsProfile.cs
index 6771cc61a..e39b05e02 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/VendorSettingsProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/VendorSettingsProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Vendors;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Settings;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/WarehouseProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/WarehouseProfile.cs
index 25480d39f..8289af28e 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/WarehouseProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/WarehouseProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Shipping;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Shipping;
diff --git a/src/Web/Grand.Web.AdminShared/Mapper/WidgetPluginProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/WidgetPluginProfile.cs
index 0e0483be0..ce3449cb5 100644
--- a/src/Web/Grand.Web.AdminShared/Mapper/WidgetPluginProfile.cs
+++ b/src/Web/Grand.Web.AdminShared/Mapper/WidgetPluginProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Interfaces.Cms;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Cms;
diff --git a/src/Web/Grand.Web.AdminShared/Models/Discounts/DiscountModel.cs b/src/Web/Grand.Web.AdminShared/Models/Discounts/DiscountModel.cs
index d981715ae..7f17cfea1 100644
--- a/src/Web/Grand.Web.AdminShared/Models/Discounts/DiscountModel.cs
+++ b/src/Web/Grand.Web.AdminShared/Models/Discounts/DiscountModel.cs
@@ -47,11 +47,11 @@ public class DiscountModel : BaseEntityModel, IStoreLinkModel
[GrandResourceDisplayName("admin.marketing.Discounts.Fields.StartDate")]
[UIHint("DateTimeNullable")]
- public DateTime StartDate { get; set; }
+ public DateTime? StartDate { get; set; }
[GrandResourceDisplayName("admin.marketing.Discounts.Fields.EndDate")]
[UIHint("DateTimeNullable")]
- public DateTime EndDate { get; set; }
+ public DateTime? EndDate { get; set; }
[GrandResourceDisplayName("admin.marketing.Discounts.Fields.RequiresCouponCode")]
public bool RequiresCouponCode { get; set; }
diff --git a/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs
index 67bf47ae3..be8564ebb 100644
--- a/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs
+++ b/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Domain.Common;
using Grand.Infrastructure.Mapper;
using Grand.Web.Vendor.Models.Common;
diff --git a/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs
index d36c8e26c..f83ddd89a 100644
--- a/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs
+++ b/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Domain.Catalog;
using Grand.Infrastructure.Mapper;
diff --git a/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs
index a744db012..57a96a54b 100644
--- a/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs
+++ b/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using Grand.Mapping;
using Grand.Business.Core.Extensions;
using Grand.Infrastructure.Mapper;
using Grand.Web.Vendor.Models.Vendor;